← SQL basics
Lesson 1 of 4
SELECT and WHERE
Watch, read the card, then practise. Choosing columns · Filtering rows · AND, OR and IN
The video for this lesson is being recorded.
Meanwhile, the notes below and the 60-second cards cover the same ideas.
Practise this topicChoosing columns
SELECT chooses which columns you see; FROM says which table they come from.
Remember: List only the columns you need; it's clearer and faster.
Filtering rows
WHERE keeps only the rows that match a condition.
Remember: WHERE filters rows before anything else happens.
AND, OR and IN
Combine conditions with AND (both true) and OR (either true). IN checks against a list.
Remember: When you mix AND and OR, add brackets.
Try the example in Code Lab
SELECT DISTINCT city FROM students ORDER BY city;