Executive employee list
EasyReturn first_name, last_name, salary from employees with explicit ORDER BY and LIMIT 20.
Six courses built around real Postgres sandboxes. Read a short lesson, write the query, see your result graded in milliseconds.
Write your first real queries — pick columns, filter rows, sort results, and limit output. The four moves you will use in every query you ever write.
SELECT first_name, salaryFROM employeesORDER BY salary DESCLIMIT 5;
Stop returning too many rows. Master WHERE clauses with AND, OR, LIKE, IN, BETWEEN, and NULL handling — the difference between a query that works and one that almost works.
What you'll learn
Turn thousands of rows into meaningful numbers. COUNT, SUM, AVG, GROUP BY, and HAVING power every dashboard and business report you will ever build.
What you'll learn
Query multiple tables at once. Master INNER, LEFT, RIGHT, and FULL OUTER joins — and finally understand which rows appear in your result and why.
What you'll learn
Break hard questions into readable steps. Subqueries and WITH blocks let you compose multi-stage logic that would be impossible — or unreadable — in a single query.
What you'll learn
The most powerful feature in SQL — and the most asked-about in data interviews. Rank rows, run totals, and compare each row to its neighbors without collapsing your result set.
What you'll learn
Extra guided exercises per course to strengthen mastery.
SQL Fundamentals
3 bonus lessons • 10 bonus exercises
Executive employee list
EasyReturn first_name, last_name, salary from employees with explicit ORDER BY and LIMIT 20.
Column precision drill
EasyReturn exactly 4 requested columns from employees and rename two with business aliases.
Deterministic top earners
MediumReturn top 15 salaries with tie-break order by employee_id.
Unique department list
EasyReturn distinct department_id values sorted ascending.
Clean contact extract
MediumReturn employee contact columns and normalize output column names with aliases.
Reproducible paging
MediumReturn rows 21-40 using LIMIT/OFFSET with stable ordering.
Salary band snapshot
MediumReturn employees with salary, plus a derived salary_band CASE expression.
QA preview view
EasyBuild a compact preview query that verifies table shape and data quality.
Sort audit
HardDemonstrate two different deterministic ordering strategies and compare outputs.
Readable SQL rewrite
MediumRefactor a messy SELECT into clean formatting with clear aliases.
Filtering & Logic
3 bonus lessons • 10 bonus exercises
Eligibility filter
EasyFilter employees by department, salary floor, and hire date threshold.
Compliance exclusion
MediumExclude rows by multi-rule policy with grouped OR conditions.
Date-range hiring set
MediumReturn hires within a target month range with explicit boundaries.
Null-safe contact check
MediumReturn employees missing email/phone with clear null logic.
Pattern targeting
EasyFind employee emails with specific domain patterns and case handling.
NOT logic challenge
MediumRewrite a complex negative filter into a readable positive equivalent.
Range segmentation
HardClassify rows into compensation ranges and filter by selected segments.
Multi-policy filter
HardImplement three business policies in one WHERE clause with comments.
Set inclusion audit
EasyUse IN/NOT IN safely and explain null pitfalls in output notes.
Filter correctness test
MediumRun count checks before/after each condition to prove logic correctness.
Aggregations & Grouping
3 bonus lessons • 10 bonus exercises
Department headcount
EasyReturn headcount per department with deterministic ordering.
Compensation KPI table
MediumReturn avg, min, max salary per department with readable aliases.
High-performing groups
MediumKeep only groups above salary or volume thresholds using HAVING.
Distinct employee coverage
EasyCompare COUNT(*) vs COUNT(DISTINCT employee_id) by group.
Revenue rollup by category
HardBuild category revenue totals with grouped order metrics.
KPI quality audit
MediumAdd count-based quality checks next to each aggregate metric.
Bucketed aggregation
HardGroup rows by computed range bucket and aggregate each bucket.
Multi-metric dashboard
HardReturn 6+ aggregate metrics in one compact management table.
Aggregation sanity check
EasyValidate expected number of groups and total row coverage.
Filtered aggregate pattern
MediumUse FILTER (WHERE ...) for conditional aggregates.
Joins
3 bonus lessons • 10 bonus exercises
Employee-department map
EasyJoin employees to departments with clear aliases and deterministic sorting.
Department coverage left join
MediumKeep all departments and include employee counts including zero-member groups.
Three-table staff view
MediumJoin employees, departments, and jobs in one clean result set.
Missing-relationship audit
MediumIdentify records with no matching lookup table rows.
Join multiplication defense
HardPrevent duplicates by pre-aggregating line-item table before join.
Store order expansion
HardJoin orders, customers, and order_items with quality-safe counts.
Hospital appointment graph
MediumJoin appointments to doctors and patients for operational reporting.
Join type comparison
EasyCompare INNER vs LEFT row counts and explain differences.
Key mismatch detector
HardCreate a query that flags suspicious foreign-key gaps across tables.
Production-ready join report
HardDeliver a final join report with row-quality validation columns.
Subqueries & CTEs
3 bonus lessons • 10 bonus exercises
Above-average salary markers
EasyUse subquery to flag employees above global average salary.
Department benchmark filter
MediumUse correlated subquery against department-level average.
Two-stage CTE pipeline
MediumBuild a CTE chain for cleaned base rows and final summary output.
Top-customer CTE
HardReturn top spenders using staged CTE logic from orders and items.
EXISTS eligibility check
MediumUse EXISTS to keep only rows with qualifying related records.
Nested query rewrite
HardRefactor nested subquery into cleaner CTE architecture.
CTE debugging drill
EasyRun each CTE stage independently and validate intermediate row counts.
Derived table comparison
MediumCompare derived table approach with CTE approach for same business question.
Multi-rule analysis pipeline
HardCreate a 3+ stage analysis pipeline with explicit business-rule stages.
Reusable CTE view pattern
HardDesign a repeatable CTE template for recurring KPI requests.
Window Functions
3 bonus lessons • 10 bonus exercises
Salary rank per department
EasyRank salaries within each department using PARTITION BY.
Dense ranking variation
MediumCompare RANK and DENSE_RANK outputs for tied salaries.
Running revenue total
MediumCompute running totals by order date and customer.
Previous period delta
HardUse LAG to calculate period-over-period change percentage.
Top-N per group
HardReturn top 3 earners per department using window filtering.
Hire timeline sequence
EasyUse ROW_NUMBER to sequence hires by department and date.
Moving average trend
HardCompute rolling 3-period average with explicit frame clause.
Quartile segmentation
MediumUse NTILE(4) to segment salaries into quartiles.
First/last value drill
MediumUse FIRST_VALUE and LAST_VALUE in partitioned windows.
Window quality audit
HardValidate partition sizes and ranking consistency in final output.
Built from learner feedback
Thea
“I wanted clear tasks I could complete in sequence, then repeat with confidence. Joins were still the hardest part.”
Sarita
“I needed logical reasoning and plain-language explanations for each command so I could remember it long term.”
Every lesson and challenge has explicit goals, expected output shape, and practical context.
We teach the logic behind SQL clauses, not just syntax, so learners can apply patterns in real work.
Learners can re-run exercises, guided hints, and challenge levels to reinforce skills quickly.