H
Hoorvia
Tech & SoftwareFree PrintableSizes: US Letter & A4

SQL Syntax Quick Reference Guide

Authentic reference chart and data matrix for SQL Syntax in SQL & Databases. Use the interactive table below or print it / save it as a PDF with the button below.

Quick-Reference Table

The full data from this cheat sheet, right on the page.

SQL Clause / CommandStandard ANSI SQL SyntaxRelational PurposePerformance / Indexing Tip
INNER JOINSELECT * FROM a INNER JOIN b ON a.id = b.a_idReturns records with matching keys in both tablesEnsure foreign keys have B-tree indexes on joining columns
LEFT OUTER JOINSELECT * FROM a LEFT JOIN b ON a.id = b.a_idReturns all records from left table and matched from rightUse to identify orphan rows with WHERE b.id IS NULL
GROUP BY / HAVINGSELECT dept, COUNT(*) FROM emp GROUP BY dept HAVING COUNT(*) > 5Aggregates rows by common values with post-group filteringFilter early with WHERE before GROUP BY to reduce hash buffer size
Window FunctionROW_NUMBER() OVER (PARTITION BY dept ORDER BY salary DESC)Calculates ranked metric across row subset without collapsing rowsOptimal for top-N ranking per partition without subqueries
Index CreationCREATE INDEX idx_user_email ON users(email);Accelerates search queries and equality filtersIndex frequently filtered/joined columns; avoid indexing low-cardinality columns

How to Use This Chart

Pin this chart where you work: it packs 5 entries and 4 columns (SQL Clause / Command, Standard ANSI SQL Syntax, Relational Purpose, Performance / Indexing Tip) into one printable page, built for quick lookups.

Scan down the SQL Clause / Command column to your item, then read across for Standard ANSI SQL Syntax, Relational Purpose.

Example: for INNER JOIN, the chart gives Standard ANSI SQL Syntax of SELECT * FROM a INNER JOIN b ON a.id = b.a_id.

  • Compare values down a single column to spot the pattern before you commit to a choice.
  • When two rows look close, the Performance / Indexing Tip column usually breaks the tie.
  • Print it once and keep it where you work — that's the whole point of a cheat sheet.

Printable Sheet Preview

High-Contrast Layout
SQL Syntax Quick Reference Guide | Hoorvia Printable Preview
Instant Direct Download • No Email Required

Download Your Free Printable Sheet

Download the printable PDF below. It is the same sheet shown in the preview above, ready to print on US Letter or A4 — open it and choose Print, with Scale set to Fit to Page.

💡 Pro Printing Tip: In your printer settings, set Scale to “Fit to Printable Area” and enable “Background Graphics” for color headers.