38
loading...
This website collects cookies to deliver better user experience
Convention | Used for | Example |
---|---|---|
CAPITAL LETTER | keyword and data types | SELECT, FROM, WHERE, OR, AND.TEXT, INTEGER, REAL. |
lower case | Parameters given by the user | nametable, name_column, etc. |
* | Select the whole table | All columns separated by rows:[{ name_column_N : ’row content’ ,name_column_N+1 : ’row content’} , { name_column_N : ’row content’ , name_column_N+1 : ’row content’ }]
|
a <> b | Mathematical conditional called function | a different to b |
a > b | Mathematical conditional called function | a greater than b |
a < b | Mathematical conditional called function | a less than b |
n = c | Mathematical conditional called function | n same as c |
n != c | Mathematical conditional called function | n different to c |
~ CREATE TABLE colombia (departament TEXT, departament_capital TEXT, geographic_extent_km2 INTEGRAL);
~ INSERT INTO colombia (departament, departament_capital, geographic_extent_km2) VALUES ('Antioquia','Medellín',63612 );
~ INSERT INTO colombia (departament, departament_capital, geographic_extent_km2) VALUES ('Bolívar','Cartagena', 25978 );
~ INSERT INTO colombia (departament, departament_capital, geographic_extent_km2) VALUES ('Valle del cauca','Cali', 22195);
~ .mode table;
~ SELECT * FROM colombia ;
| departament | departament_capital | geographic_extent_km2 |
| -------------- |----------------------|-----------------------|
| Antioquia | Medellin | 63612|
| Bolívar | Cartagena | 25978|
| Valle del cauca| Cali | 22195|
~ SELECT departament FROM colombia ;
| departament |
| -------------- |
| Antioquia |
| Bolívar |
| Valle del cauca|
~ SELECT departament, departament_capital FROM colombia ;
| departament | departament_capital |
| -------------- |----------------------|
| Antioquia | Medellin |
| Bolívar | Cartagena |
| Valle del cauca| Cali |
~ SELECT departament FROM colombia WHERE departament_capital = 'Medellín' ;
| departament |
| -------------- |
| Antioquia |
~ SELECT departament, departament_capital FROM colombia WHERE geographic_extent_km2 = 63612 ;
| departament | departament_capital |
| -------------- |----------------------|
| Antioquia | Medellin |
~ SELECT departament, departament_capital FROM colombia WHERE departament_capital <> 'Medellín';
| departament | departament_capital |
| -------------- |----------------------|
| Bolívar | Cartagena |
| Valle del cauca| Cali |
~ SELECT departament, geographic_extent_km2 FROM colombia WHERE departament_capital != 'Cartagena';
| departament | geographic_extent_km2 |
| -------------- |-----------------------|
| Antioquia | 63612|
| Valle del cauca| 22195|
~ SELECT departament, departament_capital FROM colombia WHERE geographic_extent_km2 < 26000;
| departament | departament_capital |
| -------------- |----------------------|
| Bolívar | Cartagena |
| Valle del cauca| Cali |
~ SELECT departament, departament_capital FROM colombia WHERE geographic_extent_km2 > 26000;
| departament | departament_capital |
| -------------- |----------------------|
| Antioquia | Medellin |