The SQL CASE statement: simple vs searched syntax, with examples
How the SQL CASE statement works: simple vs searched syntax, real examples for PostgreSQL, MySQL and SQL Server, and the three mistakes everyone makes.
Read the guideShort guides to the SQL questions people actually get stuck on — no jargon, small examples you can run, and the mistakes to watch for.
How the SQL CASE statement works: simple vs searched syntax, real examples for PostgreSQL, MySQL and SQL Server, and the three mistakes everyone makes.
Read the guideA plain-English guide to SQL join types — INNER, LEFT, RIGHT and FULL — with small examples showing exactly which rows each one keeps.
Read the guideWhy GROUP BY complains about columns that are not in the group, how HAVING differs from WHERE, and how to count and sum correctly.
Read the guideA practical checklist for slow SQL queries: missing indexes, functions on filtered columns, SELECT *, OR conditions, N+1 patterns and how to read a query plan.
Read the guideNULL is not zero and not an empty string. How IS NULL, COALESCE, NOT IN and aggregates behave — and how to stop NULL from quietly removing rows.
Read the guideDescribe what you need in plain English and SQLGenie writes the query, checks it against your tables and explains it. Free, no account needed.
Generate SQL free