Surfalytics

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.

Real Postgres, in-browser Run any query, safely Automatic answer checking

Course program

Every topic is theory plus hands-on exercises on the same dataset. The first section is 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.

N 1 N 1 N 1 N 1 cohorts id PK INT name TEXT start_date DATE format TEXT students id PK INT name TEXT city TEXT country TEXT cohort_id FK INT background TEXT joined_at DATE courses id PK INT title TEXT category TEXT difficulty TEXT hours INT enrollments id PK INT student_id FK INT course_id FK INT enrolled_at DATE completed_at DATE score INT job_offers id PK INT student_id FK INT company TEXT role TEXT city TEXT salary_usd INT remote BOOLEAN offer_date DATE

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