
Welcome, who the course is for (anyone who works with data: marketing, sales, operations, students, career changers, curious developers), what they will be able to do at the end, and how the course works: short lessons, queries run for real, challenges after every chapter, and two projects that tie it together.
Tables, rows and columns, why spreadsheets stop working, and what a relational database adds.
SQL as the language for asking questions of data; SQL vs. PostgreSQL vs. MySQL vs. SQL Server (95% of what you learn transfers); the four families of statements (query, define, change, control).
Optional lesson: the browser playground is enough to follow the whole course. If you also want a database on your own computer, a one-command Docker setup (Mac, Windows and Linux) starts it, loads the Brewhouse data, installs the course psql settings and opens psql; a normal PostgreSQL install works too. Includes a quick tour of the playground and your first statements.
The Brewhouse online coffee shop: customers, products, orders, order items and employees. Load it with one script, then explore the tables.
SELECT * FROM, reading a result table, and the rhythm used for the rest of the course: read the question, write the query, run it, check the result.
Choosing columns, the order of columns, and why SELECT * is only for exploring.
AS for column and table aliases, arithmetic in the SELECT list, and string concatenation.
Removing duplicates, DISTINCT on one and several columns, and counting distinct values.
Ascending and descending, sorting by several columns, sorting by an expression or alias, and where NULLs go.
Top-N queries, paging through results, and the one-line way to see the five biggest orders.
Formatting and comment habits, the style used in the course, and how to read the most common PostgreSQL errors (missing column, ambiguous column, syntax error near...) and fix them.
The logical order SQL evaluates a query (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, LIMIT). This explains many errors you will meet later.
=, <>, <, >, <=, >=, comparing numbers, text and dates.
Combining conditions, precedence, and parentheses.
Lists of values, ranges, and BETWEEN with dates (and the end-of-day trap).
Pattern matching with % and _, case-insensitive matching, and escaping wildcards.
What NULL really means, why = NULL never works, IS NULL / IS NOT NULL, and three-valued logic.
POSIX pattern matching with ~, ~* and !~, character classes, anchors, and when a regular expression beats LIKE.
Six business questions on the shop data, solved live with hints and a worked solution.
UPPER, LOWER, LENGTH, TRIM, SUBSTRING, REPLACE, CONCAT, splitting and cleaning messy text.
ROUND, CEIL, FLOOR, ABS, MOD, integer division, and why money columns use NUMERIC.
DATE, TIMESTAMP, current date and time, formatting with TO_CHAR, and time zones in one honest lesson.
Intervals, differences between dates, EXTRACT and DATE_TRUNC for months, weeks and years.
Storing JSON, the -> and ->> operators, filtering on JSON fields, and turning JSON into columns and rows.
Array columns, ANY and unnest, and generating number and date series for test data and calendars.
tsvector, tsquery, ranking results, and when LIKE is not enough.
Turning values into categories (order size, customer tier), CASE in SELECT, ORDER BY and aggregates.
Handling missing values, avoiding divide-by-zero, and converting between types.
Summarising a whole table, COUNT(*) vs. COUNT(column), and how aggregates treat NULLs.
One result row per group.
Multi-column groups, grouping by expressions (month, year), and the rule that every selected column must be grouped or aggregated.
Filtering groups, WHERE vs. HAVING, and where each fits in the order of execution.
Subtotals, cross-totals and grand totals in one query, and the GROUPING function.
Several conditional totals in one query with FILTER and CASE, for example paid vs. refunded revenue side by side.
Turning rows into columns with conditional aggregation and crosstab, and unpivoting back.
Collecting values into a list, and keeping one row per group the easy way.
Percentiles with percentile_cont, median, standard deviation, variance and correlation.
Revenue, order counts and averages by month, product category and city, with a worked solution.
INTEGER, NUMERIC, TEXT, VARCHAR, BOOLEAN, DATE, TIMESTAMP and when to use each.
Defining columns, naming conventions, and creating the practice tables.
Identifying rows, linking tables, and what a foreign key stops you from doing.
NOT NULL, UNIQUE, DEFAULT and CHECK, and how a database protects itself from bad data.
Single and multi-row inserts, inserting from a query, and letting the database generate ids.
Changing and removing rows, always previewing with SELECT first, and using a transaction as a safety net.
INSERT ... ON CONFLICT, updating if the row exists, and getting the changed rows back with RETURNING.
The standard MERGE statement (PostgreSQL 15+), and how it compares with UPSERT.
Auto-numbering the modern way, sequences, and columns calculated by the database.
Limiting a column to a fixed list of values, and when a lookup table is better.
Adding, renaming and changing columns, dropping tables, and what cannot be undone.
Why data is split across tables, one-to-many relationships, and what a join does.
Matching rows from two tables, the ON clause, and table aliases.
Keeping every row from the left table, finding customers with no orders, and the INNER vs. LEFT animation.
When to use them, and why most people just flip a LEFT JOIN.
All combinations, and joining a table to itself (employees and their managers).
Chaining customers, orders, order items and products, and many-to-many through a link table.
Changing or removing rows based on another table, and emptying a table quickly.
Stacking and comparing results, UNION vs. UNION ALL, and when to use a set operator instead of a join.
Shorter join syntax, why NATURAL is risky, and joining on ranges (price bands, date ranges).
Finding rows with no match and rows with at least one match, three ways (LEFT JOIN, NOT EXISTS, NOT IN), and which is safest.
Running a subquery for each row, for example the latest three orders of every customer.
The most common real-world join bug: one-to-many joins multiplying rows and inflating sums, and how to spot and fix it.
Seven questions that need two to four tables, with a worked solution.
IN with a subquery, comparing to a single value, and when a join is clearer.
Derived tables and scalar subqueries.
Checking for related rows, and NOT EXISTS vs. NOT IN with NULLs.
WITH ... AS, naming a step, and turning a nested query into a readable one.
Chaining CTEs, and walking an org chart with a recursive CTE.
Subqueries that refer to the outer row, when they are slow, and how to rewrite them as joins or window functions.
Customers above average spend, top product per category, and more.
OVER(), why a window function is not a GROUP BY, and the aggregate-without-collapsing idea.
Splitting rows into windows and ordering inside them.
Top N per group, ties, and the differences between the three functions.
SUM() OVER with ORDER BY, moving averages, and ROWS BETWEEN.
Comparing a row to the previous and next ones, and month-over-month change.
Buckets, first and last in a group, and a first look at percentiles.
The WINDOW clause, PERCENT_RANK, CUME_DIST and NTH_VALUE.
How the frame is really defined, the default-frame trap with ORDER BY, and EXCLUDE.
Ranking customers, running revenue and month-over-month growth, with a worked solution.
This course contains the use of artificial intelligence.
The most comprehensive SQL course on the internet: about 13 hours that cover what other courses spread over 60+ hours. Thanks to the Codepion engine, a teaching method built for speed, we teach in 1 minute what other courses teach in 5: fast typing, no fluff, and something new in every minute. You get the full picture of SQL, from your first SELECT to window functions, performance and security, in a fraction of the time.
A living course that keeps getting better. This course is built with Codepion, which means it is never frozen. When SQL, PostgreSQL or the tools change, we update the lessons, exercises and playgrounds quickly, using Codepion's instant updates, instead of leaving you with a video that is out of date in a year. Missing a topic or a project? Tell us in the Q&A: we add new content, exercises and projects based on what students ask for.
Why learn SQL? SQL (Structured Query Language) is the language of data. Almost every app, website and business stores its information in a database, and SQL is how you ask that data questions. Banks, hospitals, online shops, logistics companies, streaming services, governments and start-ups all use it every day, and it sits underneath tools such as Excel, Power BI, Tableau, Metabase and Python data work.
SQL skills are in high demand. In Stack Overflow's 2026 Developer Survey, SQL is the second most used language of all, used by about 58% of developers (ahead of HTML/CSS), and PostgreSQL, the database you learn in this course, is the most used database at about 58%. Demand reaches far beyond developers: the US Bureau of Labor Statistics projects employment of data scientists, a role where SQL is a core skill, to grow 34% from 2024 to 2034, against about 3% for all occupations. Analysts, marketers, product managers, finance and operations teams all use SQL to answer their own questions without waiting for someone else.
Nothing to install: start in seconds. Every lesson comes with a ready-to-use playground that runs real PostgreSQL right in your browser. Open the playground of a lesson, press Run, and try the exact queries from the video on the same data, with no setup, no database server and no command line. Prefer to work on your own computer? Installing PostgreSQL is optional, and we show you how.
What you get
151 short, focused video lessons: about 13 hours of tightly edited teaching with queries typed and run for real
109 hands-on coding exercises, checked instantly in your browser, each with a hint and a fully explained solution
A quick 4-question quiz before every exercise, so you arrive prepared
A playground page for every lesson, with all the lesson queries to copy, run and change
Two realistic datasets: Brewhouse, an online coffee shop, and Streamly, a video-streaming service with thousands of users and hundreds of thousands of events
Two business projects that tie everything together, and a full chapter of SQL interview preparation
Free updates: new lessons, exercises and projects are added over time, shaped by what students ask for
What you will learn
Querying and filtering: SELECT, WHERE, ORDER BY, functions, dates, text, NULLs and aggregation with GROUP BY and HAVING
Changing data safely: INSERT, UPDATE, DELETE, constraints, transactions and views
Joins in depth: INNER, LEFT, FULL and LATERAL joins, and why totals sometimes double
Subqueries, CTEs and window functions: rankings, running totals, top-N per group, year-over-year changes
Speed and reliability: indexes, EXPLAIN, locks, MVCC, VACUUM and partitioning
Real-world data: importing CSV, cleaning messy data, cohorts, funnels, retention and RFM segmentation
Design and administration: schemas, star-schema warehouses, roles, row-level security, backups and SQL injection
Who is this course for? Complete beginners, analysts, marketers, product and operations people, developers who want to master PostgreSQL, and anyone preparing for a data or backend interview. No prior experience is needed: you start from what a database is and finish able to write the queries real teams use every day.
Learn with confidence. Your purchase is covered by Udemy's 30-day money-back guarantee. Because the course is updated continuously, what you learn stays current. Press play on the first lesson and write your first query within minutes.