All courses
  • 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;
MySQL result3 rows
cityrevenue
Mumbai2600.00
Delhi1850.00
Pune1700.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.
  1. 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. 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. 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.
  1. 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
  2. 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
  3. 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
  4. 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.
  1. 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
  2. 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
  3. 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. 11.MySQL date reporting and window functions: ROW_NUMBER, RANK, LAG, running totalsReport by month with DATE_FORMAT, then use window functions — ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD and SUM OVER — on the shop and on a 4,000-order dataset.95 min · 20 problems · 4-question quiz
5Module 5: Build and changeDesign tables, change data safely, use views and indexes, and ship a capstone report.
  1. 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
  2. 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
  3. 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
  4. 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. 16.Real life database practice: hospital records (50 SQL problems)Practise 50 SQL problems on a 2,000-appointment hospital database — filtering, joins, grouping and window functions, checked in your browser.200 min · 50 problems · 3-question quiz
7Module 7: Real life database: Retail banking50 practice problems on a 2,000-row bank database, all checked in the browser.
  1. 17.Real life database practice: retail banking (50 SQL problems)Practise 50 SQL problems on a 2,000-transaction bank database — customer segments, balances, channels and monthly reporting, checked in your browser.200 min · 50 problems · 3-question quiz
8Module 8: Real life database: E-commerce marketplace50 practice problems on a 2,000-row ecommerce database, all checked in the browser.
  1. 18.Real life database practice: e-commerce marketplace (50 SQL problems)Practise 50 SQL problems on a 2,000-order marketplace database — catalog, customers, revenue and returns, checked in your browser.200 min · 50 problems · 3-question quiz
9Module 9: Real life database: College records50 practice problems on a 2,000-row college database, all checked in the browser.
  1. 19.Real life database practice: college records (50 SQL problems)Practise 50 SQL problems on a 2,000-result college database — students, courses, enrolments, marks and pass rates, checked in your browser.200 min · 50 problems · 3-question quiz
10Module 10: Real life database: Ride-hailing50 practice problems on a 2,000-row rides database, all checked in the browser.
  1. 20.Real life database practice: ride-hailing (50 SQL problems)Practise 50 SQL problems on a 2,000-trip ride-hailing database — drivers, riders, fares, surge and city performance, checked in your browser.200 min · 50 problems · 3-question quiz
11Module 11: Real life database: Streaming service50 practice problems on a 2,000-row streaming database, all checked in the browser.
  1. 21.Real life database practice: streaming service (50 SQL problems)Practise 50 SQL problems on a 2,000-session streaming database — plans, titles, watch time and completion rates, checked in your browser.200 min · 50 problems · 3-question quiz

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 →
Capstone executive summary (real output)1 row
periodcompleted_ordersrevenueaverage_order_valuebuying_customerstop_product
2026-Q166150.001025.003Keyboard

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.

Learning Shop tables and relationshipscustomers one-to-many orders; orders one-to-many order_items; products one-to-many order_items.customerscustomer_idPKcustomer_namecityemailordersorder_idPKcustomer_idFKorder_datestatusorder_itemsorder_idPK FKproduct_idPK FKquantityunit_priceproductsproduct_idPKproduct_namecategoryprice1N1N1N

customers.customer_id → orders.customer_id · orders.order_id → order_items.order_id · products.product_id → order_items.product_id

Show rows:

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.

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.

Experience