SELECT & FROM
Ask for columns from a table, and read the query back as a sentence
0 of 3 done · Lesson 1 of 9
Understand
Someone asks you for a list of the customers. The table is sitting there and you could scroll it, but you would have to do it again tomorrow. A query asks for the same thing in one line, and it answers two questions in a fixed order: which columns do you want, and which table are they in. SELECT answers the first. FROM answers the second. A star means every column, so you do not have to name them one at a time. The semicolon on the end says the command has finished. Read it back as a sentence and it says what it does: show me these columns from this table.
SELECT which_columns_you_want FROM which_table;
The tables you are working with
| customer_id | first_name | last_name | city | country | joined_date |
|---|---|---|---|---|---|
| 1 | Sarah | Smith | Auckland | New Zealand | 2025-01-15 |
| 2 | James | Brown | Wellington | New Zealand | 2025-02-03 |
| 3 | Aroha | Ngata | Christchurch | New Zealand | 2025-02-20 |
| 4 | Carlos | Garcia | Madrid | Spain | 2025-03-11 |
6 more rows in the table. Your query sees all 10.
| product_id | product_name | category | price | stock |
|---|---|---|---|---|
| 1 | Coffee Mug | Kitchen | 15 | 120 |
| 2 | Water Bottle | Outdoors | 25 | 80 |
| 3 | Hiking Backpack | Outdoors | 120 | 15 |
| 4 | Notebook | Stationery | 8.5 | 200 |
6 more rows in the table. Your query sees all 10.