Free Online Course · Self-paced
SQL Tutorial for Beginners (Hands-On with Real Examples)
Free, complete SQL tutorial - SELECT, INSERT, UPDATE, DELETE, all JOIN types, GROUP BY, aggregate and window functions, constraints, stored procedures, transactions, and date/time/string functions. 85+ runnable lessons covering MySQL, PostgreSQL, SQL Server, and SQLite.
- 84 parts
- ~780 min total
- Beginner to Intermediate
- Updated May 2026
SQL is the lingua franca of data. From a 12-row product catalogue on a side-project to a 50-billion-row event log at a tech giant, the language you ask questions in is the same: SELECT ... FROM ... WHERE ... GROUP BY. This tutorial takes you from "what is a table?" to window functions and transactions - the same path a working data analyst, backend developer, or SRE walks through in their first six months on the job.
We start with installing a free SQL engine and connecting it to VS Code, then walk through every fundamental query - filtering, joining, aggregating, updating, deleting - before moving on to the things that separate confident SQL writers from struggling ones: every JOIN type with side-by-side diagrams, GROUP BY with HAVING, the five aggregate functions, all four major constraint types, window functions, stored procedures, triggers, and transactions. Each lesson is short, every snippet was tested on MySQL 8, PostgreSQL 14, and SQL Server 2019, and the differences between vendors are called out explicitly where they matter.
Click Start the course to begin with Getting started with SQL, or jump to the topic you need - JOINs, GROUP BY, ORDER BY, Aggregates, and Window Functions and CTEs are the chapters working developers and analysts come back to most often. If you finish this course and want to specialize, the next courses are Python Tutorial (for pairing SQL with application code) and the Pandas Tutorial (for moving from SQL into in-memory data analysis).
What you'll learn
- Write `SELECT`, `INSERT`, `UPDATE`, and `DELETE` queries with confidence
- Master every `JOIN` type - INNER, LEFT, RIGHT, FULL OUTER, and self-joins on multiple tables
- Use `GROUP BY`, `HAVING`, and the five aggregate functions (`COUNT`, `SUM`, `AVG`, `MIN`, `MAX`)
- Filter with `WHERE`, `BETWEEN`, `IN`, `LIKE`, `EXISTS`, and combine conditions safely
- Apply constraints (`NOT NULL`, `UNIQUE`, `CHECK`, `FOREIGN KEY`) and pick the right data types
- Transform data with built-in string, date/time, and numeric functions across vendors
- Use window functions (`RANK`, `DENSE_RANK`, `ROW_NUMBER`) and `WITH` (CTE) for analytics
- Write stored procedures, triggers, and transactions that are safe under concurrency
Prerequisites
- A running SQL engine - MySQL 8+, PostgreSQL 14+, SQL Server 2019+, or SQLite 3 all work
- A SQL client - DBeaver, MySQL Workbench, pgAdmin, or VS Code with the SQL extension
- Comfortable on the command line (helpful but not required)
Syllabus
15 chapters · 84 lessons · ~780 min of reading
-
2 Data Types and Tables 10 lessons
- Part 5 SQL data types (INT, VARCHAR, DATE, etc.) 11 min read
- Part 6 CREATE TABLE statement 8 min read
- Part 7 ALTER TABLE and ADD COLUMN 7 min read
- Part 8 Add a column with a default value to an existing table 6 min read
- Part 9 DROP TABLE 7 min read
- Part 10 TRUNCATE TABLE 10 min read
- Part 11 Temporary tables (#temp / @table) 13 min read
- Part 12 INSERT INTO a temp table from a stored procedure 5 min read
- Part 13 Search the database for a column name 4 min read
- Part 14 Fix "ambiguous column name" errors 7 min read
-
3 SELECT Statement 7 lessons
- Part 15 SELECT TOP / LIMIT (first N rows) 8 min read
- Part 16 SELECT DISTINCT (remove duplicates) 8 min read
- Part 17 COUNT(DISTINCT col) - count unique values 16 min read
- Part 18 Select the first row in each group 5 min read
- Part 19 Select the row with the max value 8 min read
- Part 20 Find duplicate records 5 min read
- Part 21 IF / CASE WHEN inside SELECT 9 min read
-
4 INSERT, UPDATE, DELETE 9 lessons
- Part 22 INSERT INTO ... SELECT 8 min read
- Part 23 INSERT multiple rows in one statement 8 min read
- Part 24 UPDATE statement 14 min read
- Part 25 UPDATE from a SELECT 11 min read
- Part 26 UPDATE multiple columns at once 5 min read
- Part 27 UPDATE with a JOIN 7 min read
- Part 28 DELETE a row 6 min read
- Part 29 DELETE with a JOIN 5 min read
- Part 30 DELETE duplicate rows 17 min read
-
5 Filtering and Conditions 6 lessons
-
7 JOINs 8 lessons
-
10 String Functions 7 lessons
- Part 59 String concatenation (+, CONCAT, ||) 9 min read
- Part 60 CONCAT() function 8 min read
- Part 61 SUBSTRING() 10 min read
- Part 62 REPLACE() 8 min read
- Part 63 Remove characters from a string 10 min read
- Part 64 Combine rows into one string (STRING_AGG / GROUP_CONCAT) 6 min read
- Part 65 Escape single quotes in SQL 4 min read
-
12 Numeric and NULL-handling Functions 5 lessons
-
13 Window Functions and CTEs 3 lessons
-
14 Stored Procedures and Triggers 2 lessons

