A query reads like a sentence: SELECT these columns FROM this table. List columns in the order you want them back, separated by commas.
Use AS to rename a column in the result, for example price AS list_price. SELECT * returns every column and is handy for a first look, but naming columns keeps reports readable and fast.
Worked example
Show each product with its category and price.
SELECT name, category, price FROM products LIMIT 5;
| name | category | price |
|---|---|---|
| Wireless mouse | Accessories | 29 |
| Mechanical keyboard | Accessories | 89 |
| USB-C hub | Accessories | 45 |
| Noise-cancelling headphones | Audio | 249 |
| Bluetooth speaker | Audio | 79 |
Common mistakes
- Forgetting the comma between column names, which silently turns the second name into an alias.
- Using SELECT * in reports, so the output changes whenever the table gains a column.