Learn SQL

Use SQL to query a real database. Learn SELECT, filtering, sorting, grouping, joins, and how to create and change tables.

BTaught by Brad Traversy
4.8
7 enrolled

Start learning

Build real skills one lesson at a time

Explore the complete curriculum below, then start with the lesson that is right for you.

About this course

SQL is how you ask a database a question, and it is one of the few skills that goes everywhere: behind a website, an app, a dashboard, or a report. This course teaches it from zero. You do not need to know any programming language first.

Every lesson gives you a real PostgreSQL database to query. You write a query, save, and the rows come back a second later, or the error message does. The whole course uses one bookstore, so by the end you know its authors, books, customers, and orders well enough to ask it anything.

Nothing you type can break it. The database is rebuilt before every run, which makes adding, changing, and deleting data as safe to experiment with as reading it.

What you'll learn

  • SELECT and FROM, choosing columns, and renaming them with AS
  • Filtering with WHERE: comparisons, AND, OR, and parentheses
  • Patterns and ranges with IN, BETWEEN, LIKE, and IS NULL
  • Sorting and limiting with ORDER BY, LIMIT, and DISTINCT
  • Aggregates and grouping: COUNT, SUM, AVG, GROUP BY, and HAVING
  • Joining tables, including LEFT JOIN and chains across four tables
  • Changing data with INSERT, UPDATE, DELETE, and RETURNING
  • Creating tables: types, primary keys, NOT NULL, DEFAULT, REFERENCES, and ALTER TABLE

It ends with a capstone: a reservations feature for the bookstore, built end to end, from the table itself to the questions the owner asks about it every morning.

Prerequisites

  • None. No SQL, no databases, and no programming language. If you can read a spreadsheet, you can start here.

When you want to put a database behind an app, JavaScript Basics (opens in a new tab) is where the programming side starts.

Course instructor

BT

Brad Traversy

Founder of Traversy Media and an educator known for practical, project-focused web development courses.

Course content