SQL SELECT
Read rows from a table.
On this page
The concept
SELECT names the columns to return. WHERE filters rows. ORDER BY controls their order.
Code example
SQL
SELECT name, score
FROM students
WHERE score >= 80
ORDER BY score DESC;Follow the code
Open the walkthrough to inspect the example one step at a time.
Show guided walkthrough
Guided walkthroughReady
1
SELECT name, score2
FROM students3
WHERE score >= 804
ORDER BY score DESC;Follow the example
Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.
View the complete dry-run table
| Step / line | What happens | State after step | Output so far |
|---|---|---|---|
| Request the name and score columns. | — | — | |
| Read rows from students. | — | — | |
| Keep only rows whose score is at least 80. | — | — | |
| Sort the remaining rows by score, highest first. Actual rows depend on table data. | — | — |
Behind the scenes
How SQL processes this code
The database parses and plans the query, accesses the table, and returns the selected rows. Physical execution order may differ from the query’s written order.