Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
SQL / POSTGRESQL / Learn / LESSON 01
SQL describes the data you want from a table. A row is a record; a column is a typed property. SELECT chooses columns and FROM names the table. The star means all columns. This is temporary PostgreSQL: every run starts from the displayed tables. Without ORDER BY row order is not guaranteed.
Small example:
SELECT * FROM customers;Working tables for this task. Grading also uses other datasets with the same schema.
| id | name | category | price | stock |
|---|---|---|---|---|
| 1 | Book Light | books | 12 | 8 |
| 2 | Bowl | home | 20 | 4 |
| 3 | Lamp | home | 30 | 2 |
| 4 | Notebook | books | 10 | 12 |
| 5 | Box | NULL | 5 | 0 |
| 6 | Book Ocean | books | 20 | 1 |
| 7 | Mug | home | 30 | 3 |
| 8 | Pen | books | 19.99 | 7 |
| 9 | Cable | tools | 20.01 | 5 |
| 10 | Clip | tools | 9.99 | 3 |
| 11 | Fan | home | 30.01 | 1 |
| 12 | Book Edge | books | 20.01 | 2 |
| id | name | city |
|---|---|---|
| 1 | Mira | Sofia |
| 2 | Niko | Varna |
| 3 | Iva | Sofia |
| 4 | Alex | NULL |
| 5 | Boris | Plovdiv |
| 6 | Lena | Burgas |
| id | customer_id | total |
|---|---|---|
| 1 | 1 | 20 |
| 2 | 1 | 30 |
| 3 | 2 | 10 |
| 4 | 3 | 0 |
| 5 | 6 | 40 |
Expected columns: * · row order is not required
Expected result (displayed data):
Loading…SQL describes the data you want from a table. A row is a record; a column is a typed property. SELECT chooses columns and FROM names the table. The star means all columns. This is temporary PostgreSQL: every run starts from the displayed tables. Without ORDER BY row order is not guaranteed.
QUERY STANDBY
›