SQL Course
Master SQL from scratch — 71 lessons covering queries, joins, optimisation, and advanced database engineering.
A complete SQL course — SELECT queries, joins, aggregation, indexing, views and stored procedures — with interactive beginner-friendly lessons.
👋 New to SQL? It's essential for every developer.
SQL is how you talk to databases. Start with Lesson 1 — you'll be writing real queries in minutes.
Continue where you left off
Lessons in this course
- Introduction to SQL — What SQL is, what databases are, and why you need to learn SQL
- Database Basics & Tables — Create databases and tables, understand rows, columns, and data types
- SELECT Statement — Retrieve data from tables with SELECT — the most important SQL statement
- WHERE Clause & Filtering — Filter rows by conditions using WHERE, AND, OR, and comparison operators
- ORDER BY & Sorting — Sort query results in ascending or descending order with ORDER BY
- SELECT DISTINCT — Remove duplicate rows from your results
- LIMIT, OFFSET, TOP & FETCH — Return only the first N rows — and paginate results
- Column & Table Aliases (AS) — Rename columns and tables in your queries for clarity
- LIKE & Wildcards — Match text patterns with LIKE, % and _
- IN, BETWEEN & Logical Operators — Filter with IN, BETWEEN, AND, OR and NOT
- CASE Expressions — Add if/then conditional logic to your queries
- NULL Handling (COALESCE, IS NULL) — Work with NULLs safely — COALESCE, IS NULL, and the = NULL trap
- Checkpoint: Querying Data — Combine the query clauses in a challenge — then a quiz
- String Functions — CONCAT, SUBSTRING, REPLACE, TRIM, UPPER/LOWER
- Date & Time Functions — Work with dates — DATEADD, DATEDIFF, EXTRACT, NOW
- CAST & CONVERT — Convert between data types in your queries
- UNION, INTERSECT & EXCEPT — Combine the results of multiple queries
- CREATE TABLE & Data Types — Create tables and choose the right column data types
- ALTER TABLE — Add, drop and modify columns on existing tables
- Constraints (PK, FK, UNIQUE, CHECK) — Enforce data integrity with primary/foreign keys and constraints
- DROP vs TRUNCATE vs DELETE — The three ways to remove data — and when to use each
- Checkpoint: Building a Schema — Design a normalized schema with constraints — then a quiz
- JOIN Operations — Combine data from multiple tables using INNER, LEFT, RIGHT, and FULL JOINs
- Aggregate Functions — Calculate totals, averages, and counts with SUM, AVG, COUNT, MIN, MAX
- GROUP BY & HAVING — Group results and filter groups with GROUP BY and HAVING
- The HAVING Clause — Filter grouped results — WHERE for groups
- Subqueries — Nest queries inside other queries for complex data retrieval
- INSERT, UPDATE, DELETE — Add, change, and remove data in your database tables
- Indexes & Performance — Speed up queries dramatically by creating the right indexes
- Views & Stored Procedures — Create reusable views and stored procedures for complex query logic
- Transactions & ACID — Ensure data integrity with transactions, rollbacks, and ACID guarantees
- Advanced Queries — CTEs, window functions, and advanced SQL patterns for real-world data
- Final Project – Build a Full Production-Ready SQL Database System — Design, build, and optimise a complete production database from scratch
- Advanced Relational Database Theory & Normalization (BCNF, 4NF, 5NF) — Eliminate data anomalies with higher normal forms beyond 3NF
- Indexing Internals: B-Trees, Hash Indexes, Bitmap Indexes & When to Use Them — Understand index data structures and choose the right index for each query
- Query Optimization Deep Dive: Execution Plans, Cost Estimation & Hints — Read EXPLAIN plans, understand cost estimation, and apply optimiser hints
- Advanced JOIN Patterns: Anti-Joins, Semi-Joins, Cross & Lateral Joins — Use NOT EXISTS, EXISTS, CROSS APPLY, and LATERAL for complex join patterns
- Window Functions Mastery: PARTITION, ORDER, Frames, Ranking Functions — ROW_NUMBER, RANK, LAG, LEAD, and running totals with window functions
- Stored Procedures, Functions & Triggers (Advanced Use-Cases) — Write complex stored procedures, scalar functions, and audit triggers
- Transactions, Isolation Levels & Concurrency Control (ACID Deep Dive) — Read uncommitted to serializable — choose the right isolation level
- Locking, Deadlocks & High-Concurrency Performance Patterns — Understand row locks, table locks, and how to detect and prevent deadlocks
- Partitioning: Range, Hash, List & Composite Strategies — Partition large tables for query performance and maintenance efficiency
- Sharding & Distributed SQL Concepts (Vitess, Yugabyte, CockroachDB) — Scale SQL horizontally with sharding strategies and distributed databases
- Materialized Views, Caching Layers & Query Acceleration — Pre-compute expensive queries with materialized views and refresh strategies
- Advanced Aggregations & Pivot/Unpivot Techniques — GROUPING SETS, ROLLUP, CUBE, and pivot tables in SQL
- Recursive CTEs: Graph Traversal, Hierarchies & Path Queries — Traverse trees and graphs with recursive CTEs and anchor members
- Temporal Tables & Time-Travel Queries — Track historical data with system-versioned temporal tables and time-travel queries
- Full-Text Search & Fuzzy Matching Across SQL Engines — Implement full-text search with MATCH AGAINST, tsvectors, and fuzzy matching
- JSON & Semi-Structured Data Handling in SQL — Store, query, and index JSON data in PostgreSQL, MySQL, and SQL Server
- Advanced Data Types: Arrays, HSTORE, Geography, UUID — Use PostgreSQL's powerful extended types for arrays, key-value, and geo data
- Database Security: Roles, Privileges, Policies & Row-Level Security — Implement RBAC, column-level privileges, and row-level security policies
- SQL Injection Defenses & Secure Query Practices — Prevent SQL injection with parameterised queries and input validation
- Backup, Restore & High Availability Strategies — Plan database backups, test restores, and set up high availability
- Database Replication: Synchronous vs Asynchronous, Failover & Clustering — Set up primary/replica replication and automatic failover for your database
- Advanced Views & Virtual Tables for Reusable Query Logic — Build updatable views, security views, and virtual table patterns
- Analytical SQL for BI: Cubes, Rollups, Grouping Sets — Write BI-grade SQL with ROLLUP, CUBE, and GROUPING SETS
- Query Profiling Tools Across PostgreSQL, MySQL & SQL Server — Use EXPLAIN, ANALYZE, Performance Schema, and Query Store to profile queries
- Understanding Buffer Pool, Caches, Memory & I/O Optimization — Tune the buffer pool, shared buffers, and memory for faster query I/O
- Massive Data Handling: Bulk Inserts, Batching, ETL Patterns — Load millions of rows efficiently with COPY, bulk insert, and ETL patterns
- Triggers vs Application Logic — Architectural Best Practices — When to use DB triggers vs application code and how to avoid trigger pitfalls
- Schema Versioning, Migration Tools & CI/CD for Databases — Version database schemas with Flyway, Liquibase, and CI/CD pipelines
- Database Design Patterns for Large Systems (OLTP vs OLAP) — Choose between OLTP and OLAP schema designs for your workload
- Cross-Database Queries, Foreign Data Wrappers & Federated SQL — Query remote databases with FDWs, linked servers, and federated queries
- Performance Testing: Benchmarking, Stress Testing & Load Tools — Benchmark SQL performance with pgbench, sysbench, and custom load tests
- Designing Multi-Tenant Databases (Shared, Isolated, Hybrid Models) — Model multi-tenant SaaS databases with row-level, schema, or database isolation
- Data Warehousing Architecture & Star/Snowflake Schemas — Design analytical data warehouses with star schemas, fact tables, and dimensions
- Using SQL with Big Data Tools (Hive, SparkSQL, DuckDB, Presto) — Run SQL at massive scale with Hive, SparkSQL, DuckDB, and Presto
- SQL vs NoSQL: When to Use Each — Document, key-value, wide-column and graph stores, ACID vs BASE, and the CAP theorem
- Streaming & Real-Time SQL — Continuous queries, windowing and watermarks with Flink SQL, ksqlDB and Materialize
- MERGE & UPSERT — Idempotent writes with INSERT ON CONFLICT, ON DUPLICATE KEY UPDATE and MERGE
- Vector & Similarity Search — Store embeddings and run k-nearest-neighbor search with pgvector distance operators
Frequently asked questions
Is SQL a programming language?
SQL is a query language for working with relational databases rather than a general-purpose programming language. It is declarative — you describe the data you want and the database figures out how to fetch it — which makes it approachable for beginners.
How long does it take to learn SQL?
You can write useful SELECT queries within days. Mastering joins, aggregation, subqueries, indexing and database design takes a few weeks to a couple of months of practice.
Who needs to know SQL?
SQL is essential for data analysts, data scientists, backend developers, and many product and marketing roles. Almost every application stores data in a database, so SQL is one of the most broadly useful skills you can learn.
What is the difference between SQL and MySQL?
SQL is the standard language; MySQL, PostgreSQL, SQL Server and SQLite are database systems that implement it. The core syntax you learn here transfers across all of them with minor differences.
More for this course
- SQL cheat sheet — Quick syntax reference you can scan while you code
- Database Indexing Strategies — Optimize your SQL queries with proper indexing techniques and strategies.
- SQL Database Design Best Practices — Learn how to design efficient, scalable database schemas that will stand the test of time.
- SQL Joins Explained With Examples — Master INNER, LEFT, RIGHT, and FULL joins with practical SQL examples. Learn when to use each join type with visual tables and real-world database scenarios.