SQL guides for developers.
SQLumina's SQL guides take you from your first SELECT to window functions and query tuning — each one practical, example-driven, and paired with live PostgreSQL practice. Browse the 24 guides below, grouped from beginner to advanced. New to SQL? Start with the step-by-step roadmap, then work through JOINs, GROUP BY, and subqueries.
How to Learn SQL — the roadmap · Practice SQL online · SQL cheat sheet
Beginner
- How to Learn SQL in 2026: A Step-by-Step Roadmap — A clear path from your first SELECT to window functions and query tuning — what to learn in order, how long it takes, and the practice habits that actually make SQL stick.
- SQL JOINs Explained: INNER, LEFT, RIGHT & FULL — The most asked SQL topic in interviews — and the one most tutorials get wrong. A complete guide with real examples for every JOIN type.
- SQL WHERE Clause: Filtering Rows with AND, OR, IN & LIKE — The WHERE clause is how you ask a question of your data. Learn comparison operators, AND/OR logic, IN, BETWEEN, LIKE, and the NULL traps that quietly drop rows.
- SQL ORDER BY: Sorting Query Results the Right Way — Result order is not guaranteed unless you ask for it. Learn ASC/DESC, sorting by multiple columns, NULLS FIRST/LAST, sorting by expressions, and pairing ORDER BY with LIMIT.
- SELECT DISTINCT in SQL: Removing Duplicate Rows — DISTINCT collapses duplicate rows into one. Learn how it works across multiple columns, how it differs from GROUP BY, the PostgreSQL-only DISTINCT ON, and when it hides a real problem.
- GROUP BY & Aggregate Functions: A Practical Guide — COUNT, SUM, AVG, MIN, MAX and GROUP BY are how you turn raw rows into answers. Learn the patterns that show up in every real report.
- HAVING vs WHERE in SQL: What's the Difference? — Both filter rows, but at different stages. WHERE filters rows before grouping; HAVING filters groups after. Learn exactly when to use each, why it matters, and the order SQL runs in.
- SQL CASE Statement: Conditional Logic Explained — The if/else of SQL. Learn searched vs simple CASE, and how to use it inside SELECT, ORDER BY, and aggregates to reshape results without touching application code.
- SQL NULL Handling: IS NULL, COALESCE & NULLIF — NULL is not zero, and it is not an empty string — it is the absence of a value, and it follows its own logic. Master the rules that quietly break queries and interviews.
- UNION vs UNION ALL in SQL: Combining Query Results — Stack the rows of two queries into one result. Learn the rules UNION enforces, why UNION ALL is faster, and how UNION differs from a JOIN — with clear PostgreSQL examples.
- SQL INSERT: Single Rows, Bulk, INSERT…SELECT & UPSERT — Adding data is more than one row at a time. Learn single and bulk inserts, copying rows with INSERT…SELECT, RETURNING generated ids, and upserts with ON CONFLICT.
- SQL UPDATE and DELETE: Safe Data Modification — Reading data is forgiving; changing it is not. Learn to UPDATE and DELETE rows precisely — with WHERE, joins, RETURNING, and transactions that let you undo a mistake.
- PostgreSQL Data Types: Choosing the Right Column Type — The type you pick for a column decides what it can store, how it sorts, and how fast it queries. A practical tour of numbers, text, dates, booleans, JSON, and the choices that bite later.
- Primary Key vs Foreign Key in SQL Explained — Keys are how a relational database keeps data correct. Learn what primary and foreign keys do, how they link tables, what referential integrity buys you, and the ON DELETE options.
Intermediate
- SQL Self Join Explained with Real Examples — A self join is just a table joined to itself. It is how you compare rows within one table — employees to managers, prices to previous prices, finding duplicates and pairs.
- Subqueries vs CTEs: When to Use Which — Both let you build queries in steps — but they read very differently. Learn correlated subqueries, CTEs, and the cases where each one wins.
- EXISTS vs IN vs JOIN in SQL: Which Should You Use? — Three ways to ask "does a related row exist?" — and they behave differently with NULLs and on large tables. Learn when EXISTS wins, when IN is fine, and when a JOIN is clearer.
- SQL Window Functions: RANK, ROW_NUMBER, PARTITION BY — Window functions are what separate junior from senior SQL developers. Master RANK, DENSE_RANK, ROW_NUMBER, and OVER() in one read.
- SQL Date Functions: DATE_TRUNC, EXTRACT & Intervals — Working with dates trips up almost everyone. A practical guide to the PostgreSQL date toolkit — grouping by month, date math with intervals, and time-zone-safe queries.
- Database Normalization: 1NF, 2NF & 3NF Made Simple — Normalization is just organising tables so each fact lives in exactly one place. Learn 1NF, 2NF, and 3NF with a single example refactored step by step — and when to denormalize.
- SQL Transactions & ACID Properties Explained — A transaction groups several statements into one all-or-nothing unit. Learn BEGIN/COMMIT/ROLLBACK, what the four ACID guarantees actually mean, and how isolation levels prevent anomalies.
Advanced
- Recursive CTEs in PostgreSQL: Hierarchies & Sequences — When you need to walk a tree of unknown depth — org charts, category trees, bill-of-materials — a recursive CTE is the tool. Learn the anchor/recursive structure and how to stay safe.
- SQL Query Optimization: Indexes, EXPLAIN & Speed — A query that works on 100 rows can crawl on 10 million. Learn to read EXPLAIN plans, index the right columns, and avoid the classic slow-query traps.
Career
- Top 25 SQL Interview Questions (With Answers) — The 25 questions that actually come up — from DELETE vs TRUNCATE to window functions, views, and self-joins — with verified, dialect-accurate answers and the follow-ups interviewers ask next.