SQL cheat sheets
SQL is how every relational database — PostgreSQL, MySQL, SQL Server, SQLite, Oracle — is queried and changed, and the core language has stayed stable for decades. Three sheets cover the whole surface. Querying is the read path: SELECT, WHERE, ORDER BY, GROUP BY and the aggregate functions. Joins is how you combine tables — INNER, LEFT, RIGHT, FULL and CROSS, plus UNION and subqueries. Modifying data covers INSERT, UPDATE, DELETE, table creation and transactions.
Everything below is the portable core that runs identically on every major database; where vendors differ (row limits, quoting, some types), the sheet says so. One idea runs through all three: a NULL means unknown, not empty and not zero, so it behaves differently in comparisons, aggregates and joins — and it is the source of most beginner surprises.
Cheat sheets
Querying
SELECT, WHERE, ORDER BY, GROUP BY, HAVING and the aggregate functions — the read path.
Joins
INNER, LEFT, RIGHT, FULL and CROSS joins, plus UNION and subqueries — combining tables correctly.
Modifying data
INSERT, UPDATE, DELETE, CREATE TABLE with constraints, ALTER, DROP, transactions and indexes.
Network tools
Subnet CalculatorIPv6 CalculatorWildcard MaskRange → CIDRSplitterAggregatorVLSM CalculatorPracticeCheat Sheet
FAQ
What is SQL?
SQL (Structured Query Language) is the standard language for querying and modifying relational databases. The same core — SELECT, WHERE, JOIN, GROUP BY, INSERT, UPDATE, DELETE — works across PostgreSQL, MySQL, SQL Server, SQLite and Oracle, with small vendor differences in syntax sugar like row limits and some types.
Which SQL dialect should I learn?
Learn the portable core first — it is 90% of what you will write and transfers everywhere. Once you know the standard SELECT/WHERE/JOIN/GROUP BY and the DML statements, the dialect differences are small lookup-table items: LIMIT vs TOP vs FETCH FIRST, string-quoting, and type names. This sheet marks each difference inline.
What does NULL mean in SQL?
NULL represents an unknown or missing value — not zero, and not an empty string. Because it is unknown, comparisons with = , < , > all yield unknown and match nothing; the only correct test is IS NULL or IS NOT NULL. Aggregates skip NULLs, and in joins a NULL can never match another NULL.
Why do I keep hearing about indexes?
An index is a data structure that lets the database find rows by a column without scanning the whole table. Queries that filter or join on an indexed column can be orders of magnitude faster. Every primary key is indexed automatically; adding indexes to other hot columns is the single most common performance fix.