# SQL cheat sheets: querying, joins and modifying data

> Verified SQL references: SELECT, WHERE, GROUP BY and aggregates, the JOIN family, and INSERT/UPDATE/DELETE with DDL and transactions — dialect differences flagged inline.

- Page URL: https://itinsighthub.com/sql/
- Markdown variant of this page: append `?format=md` to any URL on this site or send `Accept: text/markdown`.
- Full site index for AI assistants: https://itinsighthub.com/llms.txt
- Full site export: https://itinsighthub.com/llms-full.txt

# 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](https://itinsighthub.com/sql/querying/) is the read path: `SELECT`, `WHERE`, `ORDER BY`, `GROUP BY` and the aggregate functions. [Joins](https://itinsighthub.com/sql/joins/) is how you combine tables — `INNER`, `LEFT`, `RIGHT`, `FULL` and `CROSS`, plus `UNION` and subqueries. [Modifying data](https://itinsighthub.com/sql/modifying/) 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 Calculator](https://itinsighthub.com/subnet-calculator/)[IPv6 Calculator](https://itinsighthub.com/ipv6-subnet-calculator/)[Wildcard Mask](https://itinsighthub.com/wildcard-mask-calculator/)[Range → CIDR](https://itinsighthub.com/ip-range-to-cidr/)[Splitter](https://itinsighthub.com/subnet-splitter/)[Aggregator](https://itinsighthub.com/cidr-aggregator/)[VLSM Calculator](https://itinsighthub.com/vlsm-calculator/)[Practice](https://itinsighthub.com/subnetting-practice/)[Cheat Sheet](https://itinsighthub.com/subnet-cheat-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.

---

© 2026 ITInsightHub · [About](https://itinsighthub.com/about/) · [Contact](https://itinsighthub.com/contact/) · [Privacy](https://itinsighthub.com/privacy/)
