Aggregates
Basic aggregation
Aggregate across columns
Aggregates across multiple joins
Aggregates and Statistics
Aggregates excluding leaders
Aggregates of specified size
All X for which all Y are Z
Avoiding repeat aggregation
Cascading aggregates
Cross-aggregates
Group data by datetime periods
League table
Monthly expenses
Nested aggregation
Pairwise matchmaking
Show only one child row per parent row
Skip repeating values
Values linked with all values of another column
Within-group aggregates
Within-group aggregates with a wrinkle
Within-group quotas (Top N per group)
Data comparison
Backslashes in data
Compare data in two tables
Show rows where column value changed
Database metadata
Add auto-incrementing primary key to a table
Auto-increment: reset next value
Change or drop a foreign key
Compare structures of two tables
Compare two databases
Database size
Find child tables
Find parent tables
Find primary key of a table
Find the size of all databases on the server
List databases, tables, columns
List differences between two databases
List users of a database
Rename Database
Replace text in all string columns of a database
Show
Date and time
Frequencies
Graphs and Hierarchies
Trees, networks and parts explosions in MySQL
Dijkstras shortest path algorithm
Tree query performance
Trees of known depth
JOIN
Approximate joins
Cascading JOINs
Classroom scheduling
Data-driven joins
Full Outer Join
Intersection and difference
Join or subquery?
Many-to-many joins
What else did buyers of X buy?
NULLs
List NULLs at end of query output
Parents with and without children
Ordering resultsets
Emulate Row_Number()
Next row
Order by leading digits
Order by month name
Order by numerics then alphas
Pagination
Suppress repeating ordering values
Pivot tables (crosstabs)
Pivot table basics: rows to columns
Automate pivot table queries
Group column statistics in rows
Pivot table using math tricks
Pivot table with CONCAT
Pivot table without GROUP_CONCAT
Relational division
All possible recipes with given ingredients
All X for which all Y are Z (relational division)
Who makes all the parts for a given assembly?
Sequences
Spherical geometry
Great circle distance
Statistics without aggregates
Moving average
Multiple sums across a join
Percentiles
Random row selection
Running Sum
Sum across categories
Top ten
Stored procedures
A cursor if necessary, but not necessarily a cursor
Emulate sp_exec
Variable-length argument for query IN() clause
Strings
Count delimited substrings
Count substrings
Levenshtein distance
Proper case
Retrieve octets from IP addresses
Return digits or alphas from a string
Strip HTML tags