MySQL Tutorial

MySQL is the world's most widely used open-source relational database — the storage engine behind everything from small personal projects to some of the largest websites on the internet. This track covers 33 lessons, from creating your first database through the full SQL query language, joins, indexes, transactions, stored procedures, and the administration and security skills you need to run a real database with confidence. Throughout the whole track we build one running example together — StreamHub, a small movie-streaming catalog with users, movies, genres, and reviews — so every concept lands in a real, connected context rather than isolated snippets.

Where this fits: This track stands on its own — no prior database experience needed. It's also the foundation the PHP, Laravel, Django, and Flask tracks on this site all build on when they talk about "the database."

Why Learn MySQL

Compared to...MySQL's role
A spreadsheetMySQL enforces structure and relationships between data (a review always belongs to a real user and a real movie), and scales to millions of rows without falling over
A NoSQL database like MongoDBMySQL is relational — data lives in structured tables with defined columns and relationships, and SQL is the standard query language nearly every backend framework speaks
Writing your own file-based storageMySQL gives you transactions, indexes, and concurrent access handling for free — problems that are genuinely hard to get right by hand

A Quick Look Ahead

Example: Finding a Movie's Average Rating

-- Every review in StreamHub links a user to a movie with a rating
SELECT m.title, AVG(r.rating) AS avg_rating, COUNT(r.id) AS review_count
FROM movies m
JOIN reviews r ON r.movie_id = m.id
GROUP BY m.id
ORDER BY avg_rating DESC;
Note: This is correct, real SQL — but this website's own project doesn't run a live MySQL server, so you won't see it actually execute on this page. Follow along by creating your own database after the next couple of setup lessons.

What You'll Learn In This Track

AreaCovered in
FoundationsWhat MySQL is, installation, creating databases, data types
Schema designCreating tables, primary & foreign keys, constraints, altering tables
Core SQLINSERT, SELECT, UPDATE, DELETE, sorting, operators & conditions
Querying deeperAggregate functions, GROUP BY/HAVING, joins, unions, subqueries
Functions & designString & date functions, CASE, views, normalization
PerformanceIndexes, EXPLAIN, and query optimization
ProgrammabilityTransactions & ACID, stored procedures & functions, triggers
Shipping itUsers & privileges, backup & restore, security, connecting from real application code
Next steps: Head to What Is MySQL? before we install anything — a little context makes everything after it click faster.