Almost every question you will ever ask a database starts with the same two words: SELECT (which columns you want) and FROM (which table they live in).
They matter so much that this site is literally named after them — SelectFromData. Learn this one sentence shape and you've started every data career conversation that ever happened: select something, from the data.
SELECT picks the columns, FROM names the table. That's a complete query — everything else in SQL is refinement on top of it.
See everything first
SELECT * means "every column". It's how you take a first look at a table you've never met. Here's a small employees table — run it:
Five rows, four columns — the whole table. That's already a real query against a real database, running in your browser.
Now ask for just what you need
Real questions rarely need every column. Name the ones you want after SELECT, separated by commas. Run it, then try swapping the columns — ask for name, city instead:
Two things to notice:
- The rows don't change — you get all five either way.
SELECTchooses columns, never rows. (Choosing rows is the next lesson.) - Ask for a column that doesn't exist and you get an error, not a crash. Errors are the database talking back; read them calmly.
From practice
SELECT * is great for exploring, but in real work you name the columns you need. It makes the query faster, clearer to the next reader, and safe against someone adding a giant column to the table later. Build the habit on day one.
Your turn
Return just the name and city of every employee — nothing else.
Your turn · Exercise
Return only the name and city columns, for all employees.
The data
employees
5 rows returned
| name | department | salary | city |
|---|---|---|---|
| Ada | Engineering | 62,000 | Antwerp |
| Bo | Sales | 48,000 | Ghent |
| Cy | Engineering | 71,000 | Antwerp |
| Di | Sales | 52,000 | Bruges |
| Eli | Marketing | 45,000 | Ghent |
What does the FROM part of a query do?
Next: SELECT chose the columns — WHERE chooses the rows. That's where queries start answering real questions.