Skip to main content
Databases

MySQL Tutorial with Examples.

MySQL tutorial for web and application backends: queries, indexing, replication, stored procedures and performance optimisation.

Beginner

Start here — no prior experience needed

1 lesson

Intermediate

For developers with core concepts down

6 lessons
mysql intermediate
5 min read

Filtering by genre and sorting by year: a single-column index still needs a manual sort afterward (2.87ms). A composite index on both columns delivers pre-sorted results — measured 21x faster, and the Sort step vanishes from the plan entirely.

mysql intermediate
5 min read

Forgetting the join condition on an old-style comma join doesn't error — it silently produces a cartesian product, 8,000,000 rows where 4,000 were expected. EXPLAIN's join buffer (hash join) with no ON clause is the tell.

mysql intermediate
5 min read

Under MySQL's default REPEATABLE READ, a transaction reads the same value twice even after another session commits a change in between. Switch to READ COMMITTED and the second read sees the new value — a real, measured non-repeatable read.

mysql intermediate
5 min read

Two sessions locking the same two rows in opposite order produce a genuine ERROR 1213 deadlock, not a hang — MySQL detects it and kills one transaction immediately. Locking in a consistent order eliminates it entirely, replaced by an ordinary wait.

mysql intermediate
5 min read

A stored procedure enforces a business rule with a real SIGNAL error, and a trigger logs every stock change automatically — even for updates that never call the procedure at all.

mysql intermediate
5 min read

A real mysqldump, a real DELETE with no WHERE clause, and a real restore — which undoes the mistake but also erases legitimate work done after the backup, exposing exactly what a full logical restore can't do alone.

Advanced

Production-grade patterns for experienced engineers

1 lesson

Also part of MySQL

Taught in other topics. Each link opens the lesson in its home topic.

1 lesson