SELECT & WHERE
Pick the columns you want and drop the rows you do not
0 of 3 done · Lesson 1 of 8
Understand
The sales table holds every order the company has taken, and someone has asked you for the Auckland ones. Scrolling through it and picking by eye is where mistakes come from. A query says three things instead: which columns you want, which table they live in, and which rows are worth keeping.
SELECT which_columns_you_want FROM where_it_lives WHERE which_rows_to_keep;
SELECTwhich columns you wantFROMwhich tableWHEREwhich rows to keep
The tables you are working with
8 rows
| id | customer | city | status | amount |
|---|---|---|---|---|
| 1041 | Northwind | Auckland | paid | 420 |
| 1042 | Kea Ltd | Wellington | paid | 180 |
| 1043 | Halcyon | Auckland | pending | 950 |
| 1044 | Brightsmith | Christchurch | paid | 500 |
4 more rows in the table. Your query sees all 8.