Asking the librarian
Instead of scanning every shelf, you ask the librarian 'show me all mystery novels from the 1990s.' A SELECT query is that request to the database — you describe what you want and it hands back exactly the matching rows.
SELECT what you need
SQL's SELECT statement retrieves data. You list the columns you want (or * for all), the table to read FROM, and an optional WHERE clause to filter which rows come back.
SELECT name FROM students WHERE grade = 12;
Lab · Build a query
- Choose the column to return: name.
- Name the table to read from: students.
- Filter to only 12th graders with WHERE grade = 12.
What you should see: The query returns the names of students whose grade equals 12.