Skip to main content

Course Roadmap & Structure

Editorial

Introduction

This page is the plan of Foundations - SQL: its 12 sections in the order they are taught, what each one teaches, every lesson in it, and where the course leads once it ends. Each lesson's name on this page is a link to its own page.

The Course at a Glance

Foundations - SQL has 102 lessons in 12 sections. Each section uses what the ones before it taught, so they are meant to be taken in order:

Twelve sections, one path: Foundations - SQL in the order it is taught, 102 lessons, drawn as twelve tiles along a two-row path that ends at the next course, Advanced Queries - SQL. 1, Getting Started, 4 lessons: a flag where the path starts. 2, Introduction to SQL, 6 lessons: a database. 3, SELECT Queries, 11 lessons: a table with two of its columns picked out. 4, Data Definition (DDL), 3 lessons: a table being drawn up, with a plus. 5, Data Manipulation (DML), 3 lessons: rows of a table with a new row added. 6, Filtering Data, 8 lessons: a funnel that lets one row through. 7, SQL Joins, 13 lessons: two tables with one row of each matched. 8, SQL SET Operators, 9 lessons: two overlapping circles. 9, String Functions, 10 lessons: the letters S, Q and L, one picked out. 10, Date & Time Functions, 18 lessons: a calendar with one day marked. 11, NULL Functions, 11 lessons: a row with an empty cell. 12, CASE WHEN Statement, 6 lessons: one value taking one of three branches.

Every Section and Its Lessons

Each section with what it teaches, then its lessons, numbered through the course, each with what it covers. A lesson's name opens it.

1. Getting Started

How the course works, the practice dataset and the official documentation, the plan of every section and lesson, and where to get help and meet other learners.

4 lessons

#LessonWhat it covers
1Course IntroductionWhat the course teaches, who it is for, how a lesson works and where to start
2Course ResourcesThe practice dataset and how its tables link, the official manuals, and a cheat sheet
3Course Roadmap & StructureThis plan: every section and lesson, the milestones and the courses after it
4Join the CommunityWhere to get help: Ask Peet, the comments, the Discord and the YouTube channel

2. Introduction to SQL

What SQL and databases are, what a DBMS does, the kinds of databases, the families of SQL commands, why SQL is worth learning, and how to set up a database on your own computer.

6 lessons

#LessonWhat it covers
5What is SQL and What are Databases?What a database and a relational database are, what SQL is, and a first query
6What is DBMS?What a DBMS does, how it is built, DBMS against RDBMS, and the well-known ones
7Types of DatabasesRelational, NoSQL and specialized databases, how they are deployed, and choosing one
8SQL CommandsThe five families of commands: DQL, DML, DDL, DCL and TCL
9Why Learn SQL?Where SQL is used, the careers that ask for it, and how it compares with other tools
10Environment Setup: SQL Server, SSMS and DatabasesSetting up SQLite, SQL Server, PostgreSQL or MySQL on your own computer

3. SELECT Queries

What a query is and its parts; SELECT and FROM, WHERE, ORDER BY, GROUP BY, HAVING and DISTINCT; keeping only the first rows (LIMIT, and TOP in SQL Server); the order a query runs in.

11 lessons

#LessonWhat it covers
11What is SQL QueryWhat a query is, its anatomy, and how SQLite answers one
12Components of SQLThe clauses of a query, from SELECT to ORDER BY, and the order they are written in
13SELECT & FROMChoosing columns from a table: SELECT and FROM, aliases, expressions and literal values
14WHEREKeeping only the rows that pass a test, with a first look at every filtering operator
15ORDER BYSorting the result by one column or several, by text or number, and where NULL lands
16GROUP BYFolding rows into groups and summarizing each with COUNT, SUM, AVG, MIN and MAX
17HAVINGFiltering groups once they are formed, and how HAVING differs from WHERE
18DISTINCTKeeping one row for each different value, and counting the different values
19TOPKeeping only the first rows: LIMIT and OFFSET here, TOP in SQL Server
20Coding Order vs Execution OrderThe order a query is written in against the order its clauses take effect
21Cool SQL StuffA preview of later tools: CASE, COALESCE, string, date and math tricks, and subqueries

4. Data Definition (DDL)

Creating, changing and removing tables, and the indexes and views built on them: CREATE, ALTER and DROP.

3 lessons

#LessonWhat it covers
22CREATECreating tables with their constraints, and indexes and views on them
23ALTERChanging a table: adding, renaming and dropping columns, and renaming the table
24DROPRemoving tables, indexes and views, and what depends on them

5. Data Manipulation (DML)

Adding, changing and removing rows: INSERT, UPDATE and DELETE.

3 lessons

#LessonWhat it covers
25INSERTAdding rows: one, several, or the result of a query, with NULL and DEFAULT values
26UPDATEChanging values in rows that already exist, with expressions and subqueries
27DELETERemoving rows, cascading deletes, and soft delete against hard delete

6. Filtering Data

The comparison operators, AND, OR, NOT, BETWEEN, IN and LIKE.

8 lessons

#LessonWhat it covers
28Intro - What is Data FilteringWhat filtering is, why it matters, and the kinds of operators WHERE can use
29Comparison OperatorsThe six comparison operators on numbers, text and dates
30AND OperatorRequiring every condition to hold: AND and its truth table
31OR OperatorKeeping a row when any one condition is true, and combining OR with AND
32NOT OperatorTurning a condition around: NOT with IN, BETWEEN, LIKE, AND and OR
33BETWEEN OperatorTesting a range with both ends included, on numbers, dates and text
34IN OperatorTesting a value against a list, or against the result of a subquery
35LIKE OperatorMatching text against a pattern with its two wildcards

7. SQL Joins

Why data is split across tables and how keys link them; INNER, LEFT, RIGHT and FULL joins, the three anti joins, CROSS JOIN, choosing a join, and joining several tables.

13 lessons

#LessonWhat it covers
36Intro - What is Data CombiningWhy data is split across tables, how keys link them, and the ways to combine it
37Intro to JOINSWhat a join is, its syntax, table aliases, and the ON clause
38NO JOINWhat two tables give with no join condition: the Cartesian product
39INNER JOINOnly the rows that have a match in both tables
40LEFT JOINEvery row of the left table, with its match from the right or NULL
41RIGHT JOINEvery row of the right table, the mirror of LEFT JOIN
42FULL JOINEvery row of both tables, matched where a match exists
43LEFT ANTI JOINThe rows of the left table that have no match in the right
44RIGHT ANTI JOINThe rows of the right table that have no match in the left
45FULL ANTI JOINThe rows of either table that have no match in the other
46CROSS JOINEvery row of one table paired with every row of the other
47Choosing the Right JOINWhich join answers which question, with a decision guide
48Multiple Table JOINSChaining joins across three or more tables, and self joins

8. SQL SET Operators

UNION, UNION ALL, EXCEPT and INTERSECT, the rules they share, and two uses: combining lists, and finding what changed.

9 lessons

#LessonWhat it covers
49Introduction to SET OperatorsCombining the results of two queries, and how that differs from a join
50Set Rules & SyntaxThe rules every set operator follows, column naming and data type compatibility
51UNIONThe rows of both results with duplicates removed
52UNION ALLThe rows of both results with duplicates kept
53EXCEPTThe rows of the first result that are not in the second
54INTERSECTThe rows that appear in both results
55Use Case – Combining InformationPatterns for combining data from several sources into one view
56Use Case – Delta DetectionFinding new, deleted and changed records between two versions of data
57SET Operators SummaryThe four set operators side by side: syntax, rules and when to use each

9. String Functions

What a function is; joining text, changing its case, trimming it, replacing parts of it, measuring its length and taking pieces of it; and number functions.

10 lessons

#LessonWhat it covers
58Intro - What is Data TransformationWhat transforming data means, why it is needed, and the kinds of functions
59SQL FunctionsWhat a function is, its arguments, nesting functions, and functions on NULL
60CONCATJoining text values into one, with separators and NULL handled
61UPPER & LOWERChanging the case of text, and filtering text whatever its case
62TRIMRemoving spaces or chosen characters from the ends of text: TRIM, LTRIM and RTRIM
63REPLACEReplacing every occurrence of a piece of text, or removing it
64LENCounting the characters of a text value: LENGTH here, LEN in SQL Server
65LEFT & RIGHTTaking characters from the start or the end of text, with SUBSTR in SQLite
66SUBSTRINGTaking any part of a text value by its position and length
67Number FunctionsROUND, ABS, integer division and the modulo operator

10. Date & Time Functions

Taking dates apart, cutting them to a month or a year, the last day of a month, formatting and casting, adding to a date and measuring between two, and checking that a value is a date; the lessons named after a SQL Server function (DATEPART, EOMONTH, FORMAT and others) show it beside SQLite's way.

18 lessons

#LessonWhat it covers
68What is Date & TimeWhat date and time data is, its types and formats, and the dates in the dataset
69Overview of Date & Time FunctionsThe kinds of date functions, SQLite's own, and SQL Server's beside them
70DAY, MONTH, YEARExtracting the year, the month or the day from a date
71DATEPARTAny part of a date as a number: quarter, week, day of week or hour
72DATENAMEA part of a date as text, such as the name of its month or of its day
73DATETRUNCCutting a date back to the start of its month, quarter, year or week
74EOMONTHThe last day of the month of a given date
75Use Cases – Date ExtractionDate parts at work: year over year, day of week, hour of day, quarters and cohorts
76Comparing Extract FunctionsWhen to use each of the functions that take dates apart
77Introduction to Formatting & CastingFormatting against casting: how a date is shown, and changing a value's type
78FORMATDisplaying a date in a custom format, by a pattern
79CONVERTSQL Server's CONVERT and its style codes, with the SQLite equivalents
80CASTChanging a value from one data type to another, the standard way
81DATEADDAdding days, months or years to a date, or subtracting them
82DATEDIFFThe time between two dates, in days, weeks, months or years
83ISDATEChecking that a value is a valid date before using it
84Date & Time SummaryEvery date and time function of the section in one reference
85Date & Time ScriptsPractice scripts that put several date functions to work on the dataset

11. NULL Functions

What NULL is and why a test on it can be neither true nor false; COALESCE and ISNULL; NULL in sums, arithmetic, joins and sorting; NULLIF; IS NULL; NULL against an empty string; rules for missing values.

11 lessons

#LessonWhat it covers
86Introduction to NULLsWhat NULL is, why it is not zero or an empty string, and three-valued logic
87COALESCE vs ISNULLReplacing NULL with a value: COALESCE, IFNULL and SQL Server's ISNULL
88Handling NULLs – Data AggregationHow COUNT, SUM, AVG, MIN and MAX treat NULL
89Handling NULLs – Mathematical OperationsWhy arithmetic with NULL gives NULL, and how to protect a calculation
90Handling NULLs – Joining DataWhy NULL never matches in a join, and how to find and handle unmatched records
91Handling NULLs – Sorting DataWhere NULL lands in a sorted result, and how to control its position
92NULLIFConverting a specific value into NULL, as in a safe division
93IS NULL & IS NOT NULLThe right way to test for NULL, and why an equals sign does not work
94NULL vs Empty vs BlankTelling NULL, an empty string and a blank one apart, and cleaning all three
95Handling NULLs – Data PoliciesPolicies a team can set for what NULL means and how it is replaced
96NULL SummaryEverything about NULL in one reference

12. CASE WHEN Statement

CASE's two forms and its rules, and three uses: sorting values into groups, mapping codes to names, and handling NULL.

6 lessons

#LessonWhat it covers
97Introduction to CASE StatementsCASE and its two forms, simple and searched, and how it is evaluated
98Use Case – Categorizing DataSorting values into named categories with CASE, and counting by category
99CASE RulesThe rules of CASE: END, ELSE, compatible types, the first match, nesting
100Use Case – Mapping ValuesTurning codes and abbreviations into readable labels with CASE
101Use Case – Handling NULLsDetecting NULL and providing default values with CASE
102CASE Statement SummaryCASE in one reference: syntax, common patterns and best practices

Milestones

What you can do by the end of each section:

AfterYou can
Getting StartedFind your way around the course: its plan, its data and where to get help
Introduction to SQLSay what a database, a DBMS and SQL are, and which family a SQL command belongs to
SELECT QueriesQuery one table: choose columns, filter, sort, group and count
Data Definition (DDL)Create a table, change it and remove it
Data Manipulation (DML)Add, change and remove rows
Filtering DataWrite the filters a question needs
SQL JoinsCombine two or more tables, and find the rows that have no match
SQL SET OperatorsStack, compare and subtract the results of two queries
String FunctionsClean and reshape text, and round numbers
Date & Time FunctionsGroup, compare and format dates
NULL FunctionsFind missing values and decide what a query does with them
CASE WHEN StatementTurn values into labels and categories

After Foundations - SQL

Foundations - SQL is the first of four SQL courses. The other three go on in this order:

CourseIts sections
Advanced Queries - SQL, 76 lessons in 7 sectionsWindow Functions Basics, Window Aggregate Functions, Window Ranking Functions, Window Value Functions, Subqueries, Common Table Expression (CTE), Views
Production SQL & Engineering, 69 lessons in 6 sectionsCTAS & TEMP Tables, Stored Procedures, Indexes, Partitions, Performance Best Practices, Copilot & ChatGPT for SQL
Real-World SQL Projects, 58 lessons in 4 sectionsSQL Data Warehouse Project, Exploratory Data Analysis Project (EDA), SQL Advanced Data Analytics Project, THANK YOU

How to Use This Roadmap

  • Take the sections in order. Joins come after you can query one table; the functions come after you can combine tables.
  • Run every example. A SQL block with a Run Code button runs on CodePeet; change the query and run it again.
  • Do the exercises. 90 of the 102 lessons have a Practice section, each exercise with a worked query.
  • Come back to this page to see what is next and what a section covers.

Summary

What You Learned

Next Up

Continue to Join the Community to see where to get help. Then What is SQL and What are Databases? starts the course.