SQL for beginners: the queries you will use every day
An introduction to SQL for aspiring analysts, with the core commands most data jobs rely on.
- SELECT, WHERE, GROUP BY and JOIN cover most daily work
- Practise on real datasets with free tools
- Write readable queries with clear names and formatting
SQL is the language used to ask questions of databases. Almost every data analyst, business analyst and data scientist role expects it, and the basics can be learned in a few weeks.
SELECT city, SUM(amount) AS revenue
FROM orders
WHERE order_date >= '2026-01-01'
GROUP BY city
ORDER BY revenue DESC;The core commands
- SELECT chooses columns
- WHERE filters rows
- GROUP BY with SUM, COUNT and AVG summarises
- ORDER BY sorts results
- JOIN combines tables, such as orders and customers
Joins explained
Data is often split across tables. An INNER JOIN keeps matching rows from both tables; a LEFT JOIN keeps everything from the first table, even without a match.
- 1SELECT and WHERE
- 2Aggregations
- 3Joins
- 4Subqueries
- 5Window functions
Practise
Free tools such as SQLite, PostgreSQL and online SQL practice sites let you write real queries. Try answering business questions: top customers, monthly growth, products never sold.
Write readable queries
Use clear aliases, consistent formatting and comments. Others, including your future self, will thank you.
- Filtering and sorting
- GROUP BY and HAVING
- All join types
- Subqueries
- Window functions like ROW_NUMBER
Tell us what you’re working on. Free estimate within 24 hours, NDA on request.