Home›SQL Tutorial
Free course
SQL Tutorial
Learn SQL from absolute zero, one small and easy step at a time. No experience needed. Every query is run for real on a small online bookshop database, so you see exactly what each line does. 📂 Download the practice database (shop.db): https://aihints.com/data/sql/shop.db
Course contents
Every lesson has its own page with the explanation, code you can copy, the real output, screenshots from the video, and a link that jumps straight to that moment in the video.
1. Welcome to SQL
2. Your First Queries
- Your First SELECT4:36
- Choosing Columns6:04
- Just a Few Rows7:37
3. Filtering Rows
- Filtering with WHERE9:27
- Filtering on Text11:00
- Comparing Values12:25
4. Combining Tests
5. Ranges, Patterns and Missing Values
- Ranges with BETWEEN18:50
- Patterns with LIKE19:59
- Missing Values: NULL21:19
6. Sorting Results
7. Calculations and Labels
8. Working with Text
9. Working with Dates
- How Dates Are Stored37:38
- Years and Months39:13
- Date Maths40:42
- Practice: Busy Seasons42:06
10. Counting and Totals
11. Grouping Rows
- GROUP BY49:46
- More Grouping51:08
- Grouping by Two Columns52:23
- A Grouping Mistake53:24
12. Filtering Groups
13. Joining Tables
- Why Data Lives in Many Tables59:10
- Your First JOIN1:00:44
- Short Names for Tables1:01:47
14. Inner and Left Joins
- Inner Joins Drop Rows1:03:27
- LEFT JOIN1:04:39
- Finding What Is Missing1:06:10
15. Joining Many Tables
- Joining Three Tables1:07:40
- Revenue with Joins1:09:26
- Practice: Revenue by Country1:10:52
16. More Kinds of Join
- Self Joins1:12:16
- RIGHT, FULL, and CROSS Joins1:13:36
- The Double Counting Trap1:14:59
17. Subqueries
- Subqueries1:16:59
- Subqueries with IN1:18:54
- Subqueries in FROM and SELECT1:20:16
- Correlated Subqueries1:21:27
18. CTEs, EXISTS, and Set Operations
- Common Table Expressions1:22:59
- Chaining CTEs1:24:24
- EXISTS1:25:29
- UNION, INTERSECT, and EXCEPT1:26:39
19. Window Functions
- Window Functions1:28:54
- ROW_NUMBER1:30:35
- RANK and DENSE_RANK1:31:24
- Top N per Group1:32:34
20. Running Totals and Trends
- Running Totals1:33:50
- LAG and LEAD1:35:14
- Moving Averages and NTILE1:36:16
- Practice: Who Brings the Money?1:37:22
21. Creating and Changing Data
- Creating Tables1:38:51
- Adding Rows1:40:15
- Changing Rows1:41:18
- Deleting Rows1:42:40
22. Rules, Safety, and Speed
- Constraints1:44:04
- Transactions1:45:50
- Views and ALTER TABLE1:46:57
- Indexes1:48:09
23. Designing Databases
- Designing Good Tables1:49:27
- Design Practice: Event Bookings1:51:18
- SQL Dialects1:52:27
24. Project: The Monthly Report
- Project 1: The Monthly Report1:53:47
- Monthly Numbers1:55:16
- Best Sellers of the Month1:56:41
25. Project: The Customer Report
- Project 2: The Customer Report1:58:31
- Customer Segments2:00:31
- Repeat Buyers2:01:46
26. Project: The Stock Alert
- Project 3: The Stock Alert2:03:07
- Months of Stock Left2:04:47
27. Cleaning Messy Data
- Cleaning Messy Data2:06:53
- Cleaning Text2:08:29
- Blanks and Numbers2:09:31
- Removing Duplicates2:11:05
28. Interview Questions, Part 1
- Interview Questions, Part 12:13:04
- Employees and Managers2:14:20
- Finding Duplicates2:15:11
- The NOT IN Trap2:16:08
29. Interview Questions, Part 2
- Interview Questions, Part 22:17:24
- Percentages of a Total2:18:21
- Time Between Orders2:19:58
- Retention2:21:04
30. Interview Questions, Part 3
- Interview Questions, Part 32:22:18
- More Theory Questions2:23:46
- Quick-Fire Quiz2:25:13
31. Reading Error Messages
- Reading Error Messages2:27:34
- Syntax Errors2:28:49
- Ambiguous and Misused2:30:03
- Silent Mistakes2:31:14
32. Pivots, Lists, and Recursion
- Pivot Tables in SQL2:32:43
- Lists in One Cell2:34:04
- Recursive CTEs2:34:59
- Filling Gaps in Dates2:36:18
33. Final Project: The Year in Review
- Final Project: The Year in Review2:37:35
- Growth and Stars2:39:25
- What Is Going Wrong?2:40:24
34. Practice Gym: The Basics
- Practice Gym: The Basics2:42:31
- Gym: Nulls, Maths, and CASE2:44:58
- Gym: Dates2:47:15
35. Practice Gym: Groups and Joins
- Practice Gym: Groups and Joins2:48:01
- Gym: Join Workout2:49:48
- Gym: Four Tables2:51:52
36. Practice Gym: Windows and CTEs
- Practice Gym: Windows and CTEs2:52:46
- Gym: Trends and Sizes2:54:41
- Gym Reflection2:56:14
37. Recap and Roadmap
- Your SQL Cheat Sheet2:56:56
- Your Roadmap2:59:02
- Final Quiz3:00:10