Beginner lesson, about 40 minutes
SQL in one afternoon
The five clauses that cover most everyday analysis, with examples you can run in your browser.
Most day-to-day SQL uses five clauses in a fixed order: SELECT, FROM, WHERE, GROUP BY and ORDER BY. Learn what each one does and you can answer a surprising number of business questions. Any free online SQL playground will run these examples.
A table to practise on
CREATE TABLE orders (id INT, region TEXT, amount NUMERIC, placed_on DATE);
INSERT INTO orders VALUES
(1, 'North', 120, '2026-09-01'),
(2, 'South', 80.5, '2026-09-02'),
(3, 'North', 200, '2026-09-05'),
(4, 'East', 55, '2026-09-05');SELECT and FROM: which columns, from where
SELECT region, amount FROM orders;WHERE: keep only some rows
SELECT * FROM orders WHERE amount > 100;GROUP BY: summarise rows into groups
SELECT region, SUM(amount) AS revenue, COUNT(*) AS orders
FROM orders
GROUP BY region;ORDER BY: sort the result
SELECT region, SUM(amount) AS revenue
FROM orders
GROUP BY region
ORDER BY revenue DESC;The order SQL actually runs in
You write SELECT first, but the database works FROM, then WHERE, then GROUP BY, then SELECT, then ORDER BY. That's why you can't use a column alias like revenue inside WHERE: it doesn't exist yet at that stage. Use HAVING to filter after grouping.
SELECT region, SUM(amount) AS revenue
FROM orders
GROUP BY region
HAVING SUM(amount) > 100;Next step: the Business Intelligence and Data Analytics program builds from these basics to modelling, dashboards and KPI design.