Today's tip: From Hello, World to hired.

Courses / Beginner

SQL Essentials

Ask questions of real data: SELECT, JOIN, GROUP BY and window functions on a store's orders database.

8 lessons7 hours301k learnersCertificate with Pro

Start the free first lesson

Code you'll write

JOINssql
SELECT c.name, o.ordered_at, o.total
FROM customers AS c
JOIN orders AS o ON o.customer_id = c.id
WHERE o.total > 100
ORDER BY o.ordered_at DESC
LIMIT 10;
GROUP BYsql
-- Revenue per month
SELECT strftime('%Y-%m', ordered_at) AS month,
       COUNT(*)      AS orders,
       SUM(total)    AS revenue
FROM orders
GROUP BY month
HAVING revenue > 5000
ORDER BY month;
Window functionssql
SELECT name, department, salary,
       RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS rank
FROM employees;