Interactive SQL Course
Learn SQL by writing SQL — right in your browser
A real PostgreSQL database runs on this page. Read the theory, write a query, press Run, and get your answer checked instantly. No installs, no sign-up for the first section — just SQL.
Course program
Every topic is theory plus hands-on exercises on the same dataset. The first section is free.
Basics of selection I
- 01 Basic SQL query syntax: SELECT Write your first SQL query: pick columns, select everything, and rename columns with aliases. Free
- 02 Literals and expressions Use numbers, text, and calculations directly in SELECT: arithmetic, string concatenation, and column aliases for computed values. Free
- 03 Using functions Transform values with built-in functions: UPPER, LOWER, LENGTH, ROUND, and date parts with EXTRACT. Free
- 04 Removing duplicates: DISTINCT Return each unique value once with DISTINCT, and understand how it works across several columns. Free
- 05 Filtering rows: WHERE Keep only the rows you need with WHERE: comparison operators and combining conditions with AND, OR, NOT. Free
- 06 IS NULL, BETWEEN, IN Three filtering tools you use daily: testing for missing values, ranges, and lists of values. Free
- 07 Pattern matching: LIKE Search text with LIKE and ILIKE using the % and _ wildcards. Free
- 08 Regular expressions Match complex text patterns with the ~ and ~* operators when LIKE is not enough. Free
- 09 Sorting: ORDER BY (and LIMIT) Sort results with ORDER BY, control direction with ASC/DESC, handle NULLs, and take the top N rows with LIMIT. Free
- 10 Grouping: GROUP BY, aggregates, HAVING Summarize data with COUNT, SUM, AVG, MIN, MAX, group rows with GROUP BY, and filter groups with HAVING. Free
The practice dataset
All exercises use one realistic dataset about a data-analytics community: students, cohorts, courses, enrollments, and job offers. The same tables you would model at a real company.
How the tables join
| Relationship | Cardinality | Join condition |
|---|---|---|
| students.cohort_id → cohorts.id | many students → one cohort | JOIN cohorts ON students.cohort_id = cohorts.id |
| enrollments.student_id → students.id | many enrollments → one student | JOIN students ON enrollments.student_id = students.id |
| enrollments.course_id → courses.id | many enrollments → one course | JOIN courses ON enrollments.course_id = courses.id |
| job_offers.student_id → students.id | many job offers → one student | JOIN students ON job_offers.student_id = students.id |
In short: each student belongs to one cohort. Students enroll in courses through enrollments, and their job offers land in job_offers.
Frequently asked questions
Is this SQL course really free?
Yes. The first section, Basics of selection I, is completely free — no account needed. Later sections are part of the Surfalytics membership.
Do I need to install anything?
No. A real PostgreSQL database runs directly in your browser. You write queries and see results instantly — nothing to download or set up.
What SQL dialect does the course teach?
PostgreSQL — the most popular open-source database and the closest dialect to what you will use at work with tools like Snowflake, Redshift, and dbt.
Is this course good for complete beginners?
Yes. It starts from your very first SELECT statement and builds up step by step, with hands-on exercises checked automatically in the browser.
Want the full path to a data job?
SQL is step one. Surfalytics members get the full curriculum, hands-on projects, mock interviews, and a private community.
See how membership works