Free SQL Tutorials
25 free, hands-on SQL lessons from first lines of code to advanced patterns. Run every example directly in your browser — no install, no signup.
basics
Introduction to SQL
Learn the basics of SQL and how to interact with databases using queries
Selecting Data
Master the SQL SELECT statement to retrieve specific data from your database. Learn column aliases, DISTINCT, LIMIT, and expressions.
Filtering and Sorting
Learn SQL WHERE clauses and ORDER BY to filter and sort query results. Covers IN, BETWEEN, IS NULL, and LIKE for precise data retrieval.
Inserting and Updating Data
Learn SQL INSERT, UPDATE, and DELETE statements to add, modify, and remove data in your database tables safely.
Joins and Relationships
Learn how to combine data from multiple tables using JOIN statements and understand table relationships
String Functions
Master SQL string functions to clean, transform, and extract text data. Learn UPPER, LOWER, SUBSTRING, REPLACE, and TRIM.
Null Handling
Understand how NULL works in SQL. Learn COALESCE, NULLIF, and IS NULL to write queries that handle missing data correctly.
Data Types And Casting
Understand SQL data types and type casting. Learn implicit and explicit conversion with CAST to avoid errors and data loss.
intermediate
Aggregation and Grouping
Learn to summarize data with aggregate functions like COUNT, SUM, AVG, and GROUP BY
Subqueries
Learn to write queries within queries using scalar subqueries, correlated subqueries, EXISTS, and IN
Indexes and Performance
Learn how SQL indexes speed up queries. Create indexes, analyze query plans with EXPLAIN, and optimize database performance.
Views and CTEs
Learn to organize complex queries with views, Common Table Expressions, and recursive CTEs
Transactions
Learn how to use transactions to ensure data consistency with BEGIN, COMMIT, ROLLBACK, and SAVEPOINT
Date and Time Functions
Master SQL date and time functions to query, format, and calculate temporal data. Extract date parts, compute intervals, and filter by ranges.
Set Operations
Learn SQL set operations to combine and compare result sets. Master UNION, INTERSECT, and EXCEPT for multi-query analysis.
Constraints And Keys
Learn SQL constraints to enforce data integrity. Cover PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, and DEFAULT values.
advanced
Triggers and Automation
Learn SQL triggers to automate database actions. Create audit trails, enforce rules, and run logic on INSERT, UPDATE, and DELETE events.
Window Functions
Learn to perform advanced calculations with ROW_NUMBER, RANK, PARTITION BY, LAG, LEAD, and running totals
Database Design
Learn database design with normalization, entity-relationship modeling, primary and foreign keys, and constraints for clean schemas.
Migrations
Learn to evolve your database schema safely with ALTER TABLE, data migrations, and strategies for backward-compatible changes.
Capstone Project
Build a complete e-commerce database with SQL. Design schemas, write complex joins, aggregations, window functions, and analytics queries.
Recursive Queries
Learn recursive SQL queries with WITH RECURSIVE CTEs to traverse hierarchical data, generate sequences, and solve self-referencing problems.
JSON in SQL
Learn to store and query JSON data in SQL. Use JSON functions, path expressions, and table-valued functions for semi-structured data.
Triggers and Events
Learn SQL triggers to automate database logic. Create procedures that fire on INSERT, UPDATE, and DELETE for audit trails and rules.
Query Optimization
Learn SQL query optimization with execution plans, index strategies, and common performance pitfalls to make your queries faster.