- Beginner — no SQL needed
- about 42 hours
- 21 lessons
- 566 practice problems
- Runs in your browser
MySQL course: practical SQL from beginner to professional
Learn SQL on one small, realistic shop database. Every lesson explains an idea with real MySQL 8 output, walks you through an example, and gives you problems you can run and check right here — then you finish with an audited sales report and six real-life databases with 50 problems each.
Free · no sign-up · by Amol Shukla · MySQL 8.0.16+ (8.4 LTS recommended)
What you’ll write by lesson 8
SELECT c.city,
SUM(i.quantity * i.unit_price) AS revenue
FROM orders o
JOIN customers c ON c.customer_id = o.customer_id
JOIN order_items i ON i.order_id = o.order_id
WHERE o.status = 'completed'
GROUP BY c.city
ORDER BY revenue DESC;| city | revenue |
|---|---|
| Mumbai | 2600.00 |
| Delhi | 1850.00 |
| Pune | 1700.00 |
What you’ll be able to do
- Write SELECT queries that filter, sort, transform and summarise data
- Join several tables correctly and avoid double counting
- Use subqueries, CTEs, UNION and window functions for real reports
- Design tables with keys and constraints, and change data safely in transactions
- Read EXPLAIN and add the right index
- Deliver an audited sales report with a README — a portfolio piece
Before you start
- Prerequisites
- None. No SQL, Python or programming needed.
- You need
- A browser to start. A laptop with MySQL 8.4 + Workbench (free) from lesson 2 — installation is covered step by step.
- Who it’s for
- Students, aspiring data analysts and developers, and anyone who works with spreadsheets and wants answers faster.
Syllabus
11 modules · 21 lessons · 566 problems · 78 quiz questions
1Module 1: FoundationsWhat a database is, installing MySQL and importing the practice shop.3 lessons · 4.1 h
- 1.What is a database? Tables, rows and your first SQL queryNo SQL experience needed. Learn what a database, table, row, column and primary key are, then write your first SELECT statement.85 min · 19 problems · 4-question quiz
- 2.How to install MySQL 8.4 and Workbench and run your first queryInstall MySQL Community Server and Workbench on Windows, macOS or Linux, connect on port 3306, and fix the three most common connection errors.80 min · 19 problems · 4-question quiz
- 3.Import a sample MySQL database and explore its tablesImport the Learning Shop practice database, then explore it with USE, SHOW TABLES, DESCRIBE and SELECT * before writing any analysis.80 min · 19 problems · 4-question quiz
2Module 2: One tableFilter, sort, transform and summarise the rows of a single table.4 lessons · 5.5 h
- 4.SELECT, WHERE, NULL and ORDER BY in MySQLChoose columns with SELECT, keep matching rows with WHERE, combine conditions with AND / OR / NOT, handle NULL correctly and sort results with ORDER BY.90 min · 19 problems · 4-question quiz
- 5.MySQL IN, BETWEEN, LIKE, DISTINCT and LIMIT with examplesFilter with lists (IN), ranges (BETWEEN) and text patterns (LIKE), remove duplicates with DISTINCT, and page through results with LIMIT and OFFSET.75 min · 17 problems · 4-question quiz
- 6.MySQL string, number and date functions, COALESCE and CASEClean and label data inside a query: CONCAT, UPPER, SUBSTRING, ROUND, COALESCE, IFNULL, YEAR, DATEDIFF and CASE WHEN — with the NULL traps explained.75 min · 17 problems · 4-question quiz
- 7.COUNT, SUM, AVG, GROUP BY and HAVING in MySQLSummarise rows with COUNT, SUM, AVG, MIN and MAX, make one row per group with GROUP BY, and filter groups with HAVING instead of WHERE.90 min · 19 problems · 4-question quiz
3Module 3: Many tablesJoins, subqueries, CTEs and set operations without double counting.3 lessons · 4.1 h
- 8.MySQL JOIN explained: INNER, LEFT, self join and double countingCombine tables with INNER JOIN and LEFT JOIN, find rows with no match, join a table to itself, and avoid the double counting that row expansion causes.85 min · 19 problems · 4-question quiz
- 9.MySQL subqueries, EXISTS and CTEs (WITH) step by stepUse a query inside a query: scalar subqueries, IN and EXISTS / NOT EXISTS, derived tables, and readable multi-step reports with WITH (common table expressions).85 min · 19 problems · 4-question quiz
- 10.MySQL UNION vs UNION ALL, INTERSECT and EXCEPTStack the results of several queries with UNION and UNION ALL, compare sets with INTERSECT and EXCEPT, add total rows, and emulate a FULL OUTER JOIN.75 min · 16 problems · 4-question quiz
4Module 4: AnalysisMonthly reporting and window functions on small and large data.1 lessons · 1.6 h
5Module 5: Build and changeDesign tables, change data safely, use views and indexes, and ship a capstone report.4 lessons · 6.6 h
- 12.MySQL CREATE TABLE: data types, primary keys, foreign keys and CHECK constraintsDesign tables: choose data types, add PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, DEFAULT and CHECK constraints, use ALTER TABLE, and normalise.70 min · 17 problems · 4-question quiz
- 13.MySQL INSERT, UPDATE, DELETE and transactions (COMMIT and ROLLBACK)Change data safely: INSERT rows, UPDATE and DELETE with a previewed WHERE, delete child rows first, and wrap changes in a transaction.65 min · 16 problems · 4-question quiz
- 14.MySQL views, indexes and EXPLAIN: reusable queries and faster lookupsSave a query as a view, add the right index, read EXPLAIN (type, key, rows) on a 4,000-order dataset, and turn data-quality checks into reusable views.80 min · 15 problems · 4-question quiz
- 15.MySQL capstone project: build an audited retail sales reportBuild a Q1 2026 sales report for Learning Shop: KPIs, breakdowns, reconciliation, data-quality checks and a README, scored with a rubric.180 min · 15 problems · 4-question quiz
6Module 6: Real life database: Hospital records50 practice problems on a 2,000-row hospital database, all checked in the browser.1 lessons · 3.3 h
7Module 7: Real life database: Retail banking50 practice problems on a 2,000-row bank database, all checked in the browser.1 lessons · 3.3 h
8Module 8: Real life database: E-commerce marketplace50 practice problems on a 2,000-row ecommerce database, all checked in the browser.1 lessons · 3.3 h
9Module 9: Real life database: College records50 practice problems on a 2,000-row college database, all checked in the browser.1 lessons · 3.3 h
10Module 10: Real life database: Ride-hailing50 practice problems on a 2,000-row rides database, all checked in the browser.1 lessons · 3.3 h
11Module 11: Real life database: Streaming service50 practice problems on a 2,000-row streaming database, all checked in the browser.1 lessons · 3.3 h
What you’ll build
An audited Q1 sales report — your portfolio piece
The capstone turns a business brief into KPIs, monthly, category, city and customer breakdowns, a reconciliation that proves every number adds up, data-quality checks and a README — scored with a published rubric and reviewed by your trainer if you are in a batch.
Read the capstone brief →| period | completed_orders | revenue | average_order_value | buying_customers | top_product |
|---|---|---|---|---|---|
| 2026-Q1 | 6 | 6150.00 | 1025.00 | 3 | Keyboard |
The practice database
Learning Shop is a fictional retail business with four related tables — the same shape as most real e-commerce and billing systems. The small version (6 customers, 8 orders) lets you check every answer by eye; the large version (4,000 orders over 18 months) is for window functions, indexes and EXPLAIN. Click a table to see its rows.
customers.customer_id → orders.customer_id · orders.order_id → order_items.order_id · products.product_id → order_items.product_id
Six real-life databases, 300 more problems
Six extra modules each ship a different database with 20 columns and 2,000 rows in its busiest table. Every problem preselects its database in the code arena, so you open a lesson and start writing queries — no import, no USE, no setup. Each download is a ready MySQL 8 script with the same rows.
- Module 6Real life: hospital records50 problems · City Hospital (2,000 appointments) Download .sql
- Module 7Real life: retail bank50 problems · Retail Bank (2,000 transactions) Download .sql
- Module 8Real life: e-commerce marketplace50 problems · Marketplace (2,000 orders) Download .sql
- Module 9Real life: college records50 problems · City College (2,000 exam results) Download .sql
- Module 10Real life: ride-hailing50 problems · City Rides (2,000 trips) Download .sql
- Module 11Real life: streaming service50 problems · Streaming Service (2,000 watch sessions) Download .sql
Frequently asked questions
Is this MySQL course free?
Yes. All 21 lessons, 566 practice problems, quizzes and the practice databases are free to use, with no sign-up required.
Do I need to install MySQL to start?
No. Every lesson has a practice editor that runs in your browser with the course database already loaded. Lesson 2 shows how to install MySQL 8.4 and Workbench when you are ready; employers expect you to know the real tool.
How long does the course take?
About 42 hours in total: reading, worked examples, guided practice, 566 practice problems, quizzes and a 3-hour capstone. Most learners finish in 3–5 weeks at 5–6 hours a week.
Which MySQL version does the course use?
MySQL 8.0.16 or newer, with 8.4 LTS recommended. Window functions, CTEs and enforced CHECK constraints all need MySQL 8.
Is this course enough for a data analyst job?
It covers the SQL most data analyst roles test: filtering, aggregation, joins, subqueries, CTEs, window functions and data quality, finishing with a portfolio capstone. Pair it with a spreadsheet or BI tool and practise explaining your results.
How are the practice answers checked?
Your query and the reference answer run on fresh copies of the same data in your browser, and the results are compared row by row. The core lessons' reference answers were also run on MySQL 8 and show the expected MySQL output; the six real-life modules are checked the same way, against 2,000-row databases that are already selected when each problem opens.
Your instructor: Amol Shukla
AI Developer and Trainer. Teaches SQL, Python and applied AI to students and working professionals. See his projects and experience on this site.