SELECT is the first SQL command everyone learns, and the one you will use most.
Direct answer
SELECT reads data from a table. Name the columns you want, say which table with FROM, then optionally filter with WHERE, sort with ORDER BY and limit with LIMIT.
Basic forms
SELECT * FROM customers;
SELECT name, city FROM customers;
SELECT DISTINCT city FROM customers;
SELECT name, price * 1.2 AS price_with_tax
FROM products
ORDER BY price DESC
LIMIT 10;
Order of a query
| Clause | Purpose |
|---|---|
SELECT | which columns |
FROM | which table |
WHERE | which rows |
GROUP BY | how to group |
ORDER BY | sort order |
LIMIT | how many rows |
Tips
- Avoid
SELECT *in real applications. Name the columns. - Use aliases (
AS) to make results readable. - Keywords are not case sensitive, but uppercase is a common style.
Where Teyro fits
Teyro's SQL and Databases for Beginners course turns this into short lessons you can play in a few minutes a day. It has 50 lessons, and you can start free.
The bottom line
Start with SELECT and FROM, then add clauses one at a time.


