Learn SQL UNION and UNION ALL to stack results from two queries into one list. Syntax, worked examples with output, duplicates vs speed, and common mistakes.
Tag: Learn SQL
SQL Reference: Quick Guide to All SQL Commands and Syntax
SQL reference and cheat sheet: syntax and descriptions for every major SQL command, clause, operator and function, each linked to its full tutorial chapter.
SQL Window Functions: ROW_NUMBER, RANK, LAG and Running Totals
Learn SQL window functions with OVER and PARTITION BY: ROW_NUMBER, RANK and DENSE_RANK, running totals, LAG and LEAD, moving averages, NTILE and top-N per group, with exact output.
SQL Subqueries: Nested Queries in WHERE, FROM and SELECT
Learn SQL subqueries with worked examples: scalar and multi-row subqueries in WHERE, derived tables in FROM, correlated subqueries, NOT IN vs NOT EXISTS, and when to use a JOIN or CTE instead.
SQL EXISTS Operator: Test Whether a Subquery Returns Rows
SQL EXISTS tutorial: check whether a correlated subquery returns any rows, use NOT EXISTS to find missing matches, compare EXISTS vs IN vs JOIN, and avoid the NOT IN NULL trap, with worked examples and results.
SQL HAVING Clause: Filter Groups After GROUP BY (Examples)
Learn the SQL HAVING clause step by step: filter GROUP BY results with COUNT, SUM, AVG and MIN conditions, combine HAVING with WHERE, and avoid the errors beginners hit most often.
SQL GROUP BY Clause: Group Rows and Aggregate Data (Examples)
SQL GROUP BY tutorial with a sample Orders table: syntax table, COUNT, SUM and AVG per group, grouping by several columns and by month, WHERE vs HAVING, common errors with fixes and practice exercises.
SQL FULL JOIN: Combine All Rows from Both Tables (Examples)
SQL FULL JOIN tutorial: return all rows from both tables, NULL where no match, find mismatches on either side, and emulate FULL JOIN in MySQL and SQLite.
SQL RIGHT JOIN: Keep All Rows from the Right Table (Examples)
SQL RIGHT JOIN explained with sample tables and six worked examples: keep every row from the right table, find orphan records, use COALESCE, and avoid the WHERE-vs-ON trap.
SQL Joins Explained: INNER, LEFT, RIGHT and FULL JOIN Basics
SQL joins explained: how JOIN combines rows from two tables on a key, the four join types compared on one sample dataset, ON vs WHERE, and which join to use.








