Skip to content
PractiCode Learn

SQL and Databases

Write real SQL from your first lesson, on a fresh PostgreSQL database in your browser that you can’t break. Filter, sort, summarise and join, then design and build databases of your own.

  • 10 modules, 64 lessons
  • About 40 hours
  • 10 projects and a capstone
  • Module 1 is open now, and free

Aligned to the SQL standard (ISO/IEC 9075) and ACM CS2023 · Lessons save for offline

Module 1 is open. The other modules are being written and reviewed by our instructors, and each one opens as it’s ready.

By the end, you’ll be able to

  • Explain what a database is, how tables store data, and why apps and analysts use them.
  • Write SELECT queries that filter, sort, calculate and summarise data.
  • Combine tables with joins, subqueries and common table expressions.
  • Change data safely with INSERT, UPDATE, DELETE and transactions.
  • Design a relational database from requirements: tables, keys, relationships and normalisation.
  • Build and change schemas with constraints, indexes and views.
  • Make queries faster, prevent SQL injection, and control who can see what.
  • Answer real business questions with window functions and reporting queries.

The syllabus

Tap a module to see its lessons

1Databases and your first query6 lessons · about 1 hourFree

What a database is, how tables work, and your first queries: choosing, filtering and sorting.

  1. What a database is
  2. Tables, rows and columns
  3. Your first SELECT
  4. Choosing columns
  5. Filtering with WHERE
  6. Sorting and limiting
Module projectModule check

Project: Answer ten questions about a bookshop's stock

2Filtering like a pro7 lessons plannedComing soon

Sharper questions: AND and OR, ranges, text search, missing data and CASE.

  1. AND, OR and NOT
  2. Ranges with BETWEEN and IN
  3. Searching text with LIKE
  4. NULL and missing data
  5. Calculated columns
  6. CASE
  7. Common mistakes
Module projectModule check

Project: Find the customers a shop should contact

3Summarising data6 lessons plannedComing soon

Turn rows into answers: counts, totals, averages, groups and dates.

  1. COUNT, SUM, AVG, MIN and MAX
  2. GROUP BY
  3. HAVING
  4. DISTINCT
  5. Dates and times
  6. Rounding and formatting
Module projectModule check

Project: A sales summary by month and product

4Joining tables7 lessons plannedComing soon

Combine tables with keys and joins, and avoid the classic join mistakes.

  1. Why data lives in many tables
  2. Primary and foreign keys
  3. INNER JOIN
  4. LEFT JOIN
  5. Joining three tables
  6. Self joins
  7. Join mistakes
Module projectModule check

Project: One report from orders, customers and products

5Subqueries and CTEs6 lessons plannedComing soon

Queries inside queries, common table expressions, EXISTS and UNION.

  1. Subqueries in WHERE
  2. Subqueries in FROM
  3. Common table expressions
  4. EXISTS
  5. UNION and friends
  6. Window functions: a first look
Module projectModule check

Project: Top sellers and repeat customers

6Changing data6 lessons plannedComing soon

Insert, update and delete safely, with transactions and constraints.

  1. INSERT
  2. UPDATE
  3. DELETE
  4. Transactions
  5. Constraints that protect data
  6. Upserts
Module projectModule check

Project: Run a stock update safely in a transaction

7Designing a database7 lessons plannedComing soon

Design tables from real requirements: keys, relationships and normalisation.

  1. From requirements to tables
  2. Data types
  3. Keys and relationships
  4. Normalisation
  5. Many-to-many tables
  6. Naming and conventions
  7. Diagrams (ERDs)
Module projectModule check

Project: Design a database for a library

8Building and changing schemas6 lessons plannedComing soon

Create and change tables, and add indexes, views and migrations.

  1. CREATE TABLE
  2. ALTER TABLE
  3. Indexes
  4. Views
  5. Migrations
  6. Seed data
Module projectModule check

Project: Build the library database, with indexes and a view

9Performance and security6 lessons plannedComing soon

Faster queries, no SQL injection, the right permissions and safe personal data.

  1. How queries run: EXPLAIN
  2. Indexes that help
  3. SQL injection
  4. Users, roles and permissions
  5. Backups
  6. Privacy and data protection
Module projectModule check

Project: Speed up slow queries and lock down access

10SQL for analysis7 lessons plannedComing soon

Window functions, rankings, running totals and the reports analysts write every week.

  1. Window functions
  2. Ranking and running totals
  3. Pivoting
  4. Cleaning messy data
  5. Cohorts and funnels
  6. Reporting queries
  7. Where to go next
Module projectModule check

Project: A monthly report with ranking and running totals

Some of what you’ll build

  • Module 4 · Coming soon

    One report from orders, customers and products

  • Module 7 · Coming soon

    Design a database for a library

  • Module 10 · Coming soon

    A monthly report with ranking and running totals

Module 1 takes about an hour. It’s free.

Start Module 1 Free