A hands-on practical course for anyone who wants to learn modern SQL


A hands-on course, built for the busy learner

Packed with high quality videos, practical examples, and interesting and challenging exercises to practice what you've learned. The course is broad and deep, taking you from beginner level to mastery with SQL and doing it in a way that creates a deep understanding of what you've learned. My goal is to give you the practical tools and skills you need to get your job done.
Learn Modern SQL

In this course we use PostgreSQL 11 and modern SQL (Common Table Expressions, Window Functions, etc). You'll learn modern notation and follow best practices.

Jam Packed with exercises

Over 150 interesting and challenging real-world exercises (with solutions) to test your understanding and ability to use SQL. Get practice applying every concept you learn.

Beginner Friendly

You don't need any prior knowledge or experience to do this course. And if you've got some prior experience with SQL and are looking to go deeper, this course can help you too.


Up to date with the latest SQL features, providing clear instruction and lots of opportunities to get hands-on practice with the cutting edge.

Practical real world examples

All the examples and exercises are drawn from a sample database for a fictitious movie rental company. You'll learn to write queries to answer real world questions about sales, staff, films, and customers.

HD video and top notch audio

All videos are available in HD and delivered with clear audio.

Do you find databases and SQL intimidating?

SQL is a difficult language to master and is quite different from most programming languages. Let me help you take the fear out of it all. This course is made for real people.
What's a typical video like?
SQL: Inserting data

Want to see some more examples?

Learn by doing

The best way to learn is by doing, not just watching videos. In this course, you’ll learn by challenging yourself with over 150 exercises from beginner level to advanced, complete with solutions and discussion.
The exercises and examples use a sample database for a fictitious movie rental company. There’s a lot of questions you’ll have about this company. How many customers does it have? Which movies are grossing the highest amount for the business? Which stores are out of stock of particular films? You’ll be writing queries to answer real world questions about sales, staff, films, and customers.

Master PostgreSQL

Throughout this course you'll be learning SQL using PostgreSQL, the world's most advanced open source relational database. You'll learn about (and practice using) PostgreSQL features like DISTINCT ON, lateral joins, date math with intervals, set returning functions, modern window functions, materialized views, and more.
But you'll also be learning ANSI SQL too and I'll discuss when we deviate from it and why, so even if you happen to be using Microsoft SQL Server, MySQL, or Oracle Database you'll still learn key concepts and skills that easily transfer over.

Level up in snack sized pieces

The emphasis of the course is on learning SQL techniques to solve real problems and practicing those techniques in both simple and complex situations. You'll spend most of your time working through the exercises, getting practice to help you level up. Perfect for the busy adult (and battle tested by a busy mum of two young boys *)

Come across a problem you don't currently have the tools to solve


Learn a new technique to attack the problem


Apply the technique to a straightforward problem


Apply the technique in a novel way, combining with earlier learned techniques

Neil Sainsbury

About Me

I'm Neil Sainsbury, a software developer and database expert, and I built this course to share what I’ve learned from over 10 years of working with relational databases and SQL.
Previously, I was the co-founder and Chief Technology Officer at RateIt, a customer feedback platform used by millions of people, and I also did heavy data-crunching work applying neural networks to analyze mining site microseismic data at CSIRO.
I've worked with many different companies around the world including BlackBerry, Ball Aerospace, Mobile Nations, and others and built and shipped multiple products at my own company, BBSmart.

What you're going to be learning

1. Introduction to databases and the relational model
3 videos 26 minutes

1. Course introduction (3:34)

2. Databases and SQL (10:46)

3. Tables and the relational model (12:19)

2. Getting setup
5 videos 39 minutes

4. Installing PostgreSQL and DBeaver (Windows) (4:29)

5. Installing PostgreSQL and DBeaver (Mac) (4:46)

6. Creating your first database and table (19:30)

7. Several nice tweaks for DBeaver (4:13)

8. Setting up the sample database (6:05)

3. Query fundamentals
11 videos 79 minutes 43 exercises

9. SELECT FROM (8:18)

10. Derived Columns (11:26)

11. Filtering with WHERE (10:29)

12. AND, OR, and NOT (5:09)

13. NULL handling (5:28)

14. IN, BETWEEN, and LIKE (7:13)

15. ORDER BY (8:39)

16. SQL Order of execution (5:25)

17. LIMIT and OFFSET (5:08)

18. DISTINCT (4:34)

19. CASE expressions (7:31)

4. Aggregate functions and grouping
3 videos 27 minutes 14 exercises

20. Common aggregate functions (4:19)

21. GROUP BY and HAVING (11:45)

22. CASE expressions and aggregations (10:46)

5. Understanding data types
4 videos 65 minutes 14 exercises

23. Introduction to data types (14:03)

24. Character data types (11:51)

25. Number data types (19:09)

26. Date and time data types (19:39)

6. Joining data from multiple tables
5 videos 49 minutes 11 exercises

27. Introduction to joins (2:57)

28. Cross joins (8:40)

29. Inner joins (12:26)

30. Outer joins (16:33)

31. Advanced join topics (8:53)

7. Subqueries
5 videos 49 minutes 16 exercises

32. Uncorrelated subqueries (11:00)

33. Correlated subqueries (13:12)

34. Table subqueries (11:43)

35. Lateral subqueries (4:40)

36. Common table expressions (8:14)

8. Window functions
3 videos 30 minutes 8 exercises

37. Ranking window functions (8:56)

38. Aggregate window functions (12:39)

39. LAG and LEAD (8:07)

9. Working with sets
4 videos 22 minutes 8 exercises

40. A little bit of set theory (3:10)

41. UNION (7:40)

42. INTERSECT (4:20)

43. EXCEPT (7:01)

10. Creating tables and constraints
4 videos 54 minutes 14 exercises

44. Creating tables (14:41)

45. Primary keys (17:48)

46. Foreign keys (11:05)

47. CHECK, UNIQUE, and NOT NULL constraints (10:47)

11. Inserting, updating, and deleting data
4 videos 33 minutes 14 exercises

48. Importing and exporting data (10:28)

49. Using transactions and inserting data (9:10)

50. Updating data (8:58)

51. Deleting data (4:28)

12. Views and functions
5 videos 35 minutes 10 exercises

52. Views (7:48)

53. Materialized views (5:44)

54. Functions (2:27)

55. Writing functions with SQL (8:24)

56. Writing functions with PL/pgSQL (10:15)

13. Query performance and indexing
4 videos 45 minutes

57. Query plans with EXPLAIN (11:30)

58. Indexes (10:56)

59. Reading complex query plans (10:17)

60. Query optimization (11:30)

Ready to level up with SQL?

30 day money back guarantee. Find it's not a good fit? I'll refund you in full

Join thousands of other learners today
Buy now

Over 60 HD videos and 9+ hrs video

150+ real-world like exercises and solutions

Free lifetime updates

Mobile access

What customers are saying...

I can't recommend this course enough. After working through all the videos and especially the exercises, I feel like I've got an incredibly strong grasp of SQL now. And PostgreSQL is awesome too!

Rob Kao
Founder, Problem Solver, Author

I've studied SQL before but learned so many great new tips and tricks working through the course. The exercises were just right - not too easy and not too hard.

James Hull
Network Engineer

Frequently Asked Questions

Do you offer student discounts?

Yep! Email me at neil@masterywithdata.com with your details and some proof (student ID, etc.) and I'll organize a special discount for you.

Can I purchase several copies for my team?

Yep! Email me at neil@masterywithdata.com and I'll organize a team discount and can also offer bulk course enrollment and account setup.