Printable SQL Cheat Sheet

Free printable SQL syntax cheat sheet at exact scale — the SQL you use every day grouped by task: reading data with SELECT, filtering with WHERE, sorting and grouping, aggregate functions, every kind of JOIN, inserting/updating/deleting rows, creating tables and indexes, handling NULLs, and the advanced set operations, subqueries, CTEs and window functions, all on one page.

This SQL cheat sheet collects the clauses and keywords that turn up in almost every query and groups them by what you’re trying to do — selecting and aliasing columns, filtering with comparison, BETWEEN, IN and LIKE, combining tables with inner, left, right, full and cross joins, summarising with COUNT, SUM, AVG, GROUP BY and HAVING, and modifying data with INSERT, UPDATE and DELETE.

It also covers schema work (CREATE TABLE, constraints, foreign keys, ALTER TABLE, indexes and views), NULL handling with COALESCE and CASE, and the power tools that separate beginners from pros: set operations (UNION, INTERSECT, EXCEPT), correlated subqueries, common table expressions and window functions like ROW_NUMBER, RANK, LAG and LEAD.

Which SQL topics are covered?

SELECT and column aliasing, WHERE filtering, ORDER BY / GROUP BY / HAVING, aggregate functions, inner/left/right/full/cross and self joins, INSERT/UPDATE/DELETE/TRUNCATE, DDL (CREATE/ALTER/DROP tables, constraints, indexes, views), NULL handling and CASE, casting, set operations, subqueries, CTEs and window functions.

Which SQL database is this for?

The core syntax is standard SQL and works across most databases. Where dialects differ, rows are noted for PostgreSQL, MySQL, SQL Server and SQLite — for example LIMIT vs TOP, STRING_AGG vs GROUP_CONCAT, and the :: cast shorthand.