MySQL Reference

The MySQL Cheat Sheet Every Developer Bookmarks

Every SELECT pattern, JOIN type, aggregate function, and index strategy — organised by what you're actually trying to do. Stop staring at a blank query editor and keep the complete SQL reference at your fingertips.

$9
One-time payment · Instant PDF download
📄 PDF format ⚡ Instant download 🖨️ Print-ready ♾️ Keep forever
mysql-cheat-sheet.pdf
SELECT QUERIES
SELECT * FROM tableFetch all rows
WHERE col = valFilter rows
ORDER BY col DESCSort results
JOINS
INNER JOIN t ONMatching rows both
LEFT JOIN t ONAll left + matches
GROUP BY col HAVINGAggregate filter
MODIFYING DATA
INSERT INTO t VALUESAdd row
UPDATE t SET col=vModify rows
DELETE FROM t WHERERemove rows

What's inside the MySQL Cheat Sheet

8 sections covering every aspect of MySQL from basic SELECT queries to indexes, transactions and query optimisation.

🔍

SELECT with WHERE / ORDER / LIMIT

Write precise queries that return exactly the data you need, in the right order.

  • SELECT with column aliases
  • WHERE with AND, OR, IN, BETWEEN, LIKE
  • ORDER BY (ASC/DESC) and NULLS
  • LIMIT and OFFSET for pagination
🔗

All JOIN Types (INNER/LEFT/RIGHT/CROSS)

Combine data from multiple tables confidently with every JOIN type explained.

  • INNER JOIN — only matching rows
  • LEFT JOIN — all left, matching right
  • RIGHT JOIN — all right, matching left
  • CROSS JOIN and self joins
📊

Aggregate Functions (COUNT/SUM/AVG)

Summarise and group your data with aggregate functions and the HAVING clause.

  • COUNT(*), COUNT(col), COUNT(DISTINCT)
  • SUM, AVG, MIN, MAX
  • GROUP BY with multiple columns
  • HAVING vs WHERE for aggregates
✏️

INSERT, UPDATE, DELETE

Modify your data safely with the correct syntax for every write operation.

  • INSERT INTO with single and multi-rows
  • INSERT ... ON DUPLICATE KEY UPDATE
  • UPDATE with WHERE (never forget!)
  • DELETE with LIMIT and subqueries
🏗️

CREATE TABLE & ALTER TABLE

Design and modify table schemas with the correct column types and constraints.

  • Column types (INT, VARCHAR, TEXT, DATE…)
  • NOT NULL, DEFAULT, AUTO_INCREMENT
  • ALTER TABLE (add/drop/modify columns)
  • RENAME TABLE and DROP TABLE

Indexes & Keys (PRIMARY/FOREIGN/INDEX)

Speed up queries and maintain data integrity with the right index strategies.

  • PRIMARY KEY and UNIQUE constraints
  • FOREIGN KEY with ON DELETE/UPDATE
  • Creating and dropping indexes
  • Composite index strategy
🔒

Transactions & ACID

Keep your data consistent with proper transaction management.

  • START TRANSACTION, COMMIT, ROLLBACK
  • SAVEPOINT and ROLLBACK TO
  • Isolation levels explained
  • Deadlock avoidance patterns
🚀

Performance Tips & EXPLAIN

Diagnose and fix slow queries with the right tools and patterns.

  • EXPLAIN and EXPLAIN ANALYZE
  • Reading query execution plans
  • Index usage and covering indexes
  • Avoiding N+1 and full table scans

Who this cheat sheet is for

  • Backend developers who write SQL but still look up the exact JOIN syntax every time
  • Developers building database-driven applications who need a fast query reference
  • Data analysts querying production databases who need aggregate and grouping reference
  • PHP and Python developers working with MySQL backends
  • Developers optimising slow queries who need EXPLAIN and indexing guidance

What you get

📄
PDF file
High-resolution, print-ready PDF. Works on any device.
Instant access
Download immediately after purchase via Gumroad.
🖨️
Print-optimised
Designed to look perfect on A4 or US Letter paper.
♾️
Yours forever
One payment. No subscription. Download again any time.
Instant Download
$9
One-time payment · PDF · No subscription

Get the MySQL Cheat Sheet now

Stop staring at a blank query editor. Keep the complete SQL reference at your fingertips.

Buy on Gumroad →