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 06
raw_orders repeats customer_name and city on every order. Prefer customers + orders with customer_id. Create the normalized tables and move data with INSERT…SELECT DISTINCT / INSERT…SELECT.
Small example:
CREATE TABLE customers (...);
CREATE TABLE orders (...);
INSERT INTO customers ... SELECT DISTINCT ...;
INSERT INTO orders ... SELECT ...;Starting tables for this task. Grading checks final state on other datasets too.
| id | customer_name | city | total |
|---|---|---|---|
| 1 | Mira | Sofia | 20 |
| 2 | Mira | Sofia | 30 |
| 3 | Niko | Varna | 10 |
Expected verify columns: table_name, name, city, id, total · row order is checked
Expected final state (displayed data):
Loading…raw_orders repeats customer_name and city on every order. Prefer customers + orders with customer_id. Create the normalized tables and move data with INSERT…SELECT DISTINCT / INSERT…SELECT.
QUERY STANDBY
›