Part · Chapter

Practice sites and working with AI

The site you remembered is still online, so here it is with the others worth your evenings, a four-week plan, and a way to ask an AI for syntax while you stay the person who decides what is safe to run.

The short version

  • Start with the SQL Murder Mystery. It is the free browser game you half remember, and one evening brings your joins back.
  • Games teach querying, your own server teaches the job. No practice site lets you create a user or take a backup.
  • Use a sandbox to check a version. dbfiddle.uk runs MySQL 5.5 through 9.7 side by side.
  • Four weeks, three sessions a week. Two weeks in the browser, then two on the MySQL server you installed.
  • Give the AI six things. Engine and version, schema, sample rows, expected output, constraints, and a request to explain itself.
  • Verify every answer. Run it on dev, wrap writes in a transaction, and read the WHERE clause before an UPDATE or DELETE.

Practice sites, in the order to try them

The list is ordered by what to try first, so work down it: story games, then drill sets, then the MySQL ones. Most games run SQLite inside your browser, which is fine, because joins, grouping and NULL behave there as they do in MySQL. Dates, error messages and the system catalog do not, and you will practice those on your own server in week 3. A badge means the site runs your query on a real engine: MySQL PostgreSQL.

For you as a DBA

Every site above is query practice. Creating a user, taking a backup, reading an error log or editing my.ini can only be rehearsed on the server you installed in chapter 4.

A four-week plan that follows this course

Three sessions of about 45 minutes a week. Weeks 1 and 2 need nothing installed; weeks 3 and 4 use your own MySQL.

WeekFocusWhere
1SELECT, filtering, joins (chapter 7)SQLBolt lessons 1 to 12, then SQL Murder Mystery without the walkthrough, then SQL Island for your first UPDATE and DELETE
2Aggregation and window functions (chapter 8)The aggregation section of PostgreSQL Exercises, then LeetCode SQL 50 with MySQL 8.0 selected
3Report queries a manager would ask for: top customers, revenue by month, films never rentedYour own MySQL (chapter 4) with the shop dataset and sakila (chapter 6)
4DBA drills: backup and restore, users and grants, plans, logsYour own server, following chapter 15, chapter 14, chapter 10 and chapter 16

Sandboxes, playgrounds and the shop dataset

A sandbox is an empty database inside a web page: you paste some DDL and a query, pick an engine and a version, and see the result. Reach for one to test a statement against an exact version, to compare 8.4 with 9.7, or to send a colleague a reproducible example. W3Schools' MySQL Tryit editor is not one of these, because it is not a MySQL server. These five were checked in September 2026.

Careful

Every sandbox is a public server, so never paste company table names, customer rows or a dump into one. Rebuild the shape with the shop dataset instead, and test anything that matters on 8.4 or 9.7.

That dataset ships with the course as assets/sample-shop.mysql.sql and assets/sample-shop.postgres.sql. Load it once and every example in chapters 7 to 15 becomes something you can run, break and fix on your own machine.

PowerShell
# MySQL: PowerShell reserves "<", so hand the redirect to cmd.exe
cmd /c "mysql -u root -p < C:\dba\assets\sample-shop.mysql.sql"
# ...or start mysql and type:  source C:/dba/assets/sample-shop.mysql.sql

# PostgreSQL: psql reads a file with -f (run chcp 1252 first in a plain console)
psql -U postgres -f C:\dba\assets\sample-shop.postgres.sql

Asking an AI for syntax

An assistant has read every manual and none of your tables, so the prompt has to carry what it cannot see. Six ingredients, in the same order, whether you want a query, a script or a diagnosis.

Prompt template
1. Engine, version, platform: "MySQL 9.7 LTS on Windows 11, default sql_mode".
2. Schema: the CREATE TABLE statements, or every column with its type, keys and NULLs.
3. Sample rows going in, and the exact rows you expect to come out.
4. Constraints: one statement, no temporary tables, the account has only SELECT.
5. Ask for a clause-by-clause explanation and the EXPLAIN statement to run.
6. End with "what could go wrong?"

Four prompts that cover most of the week:

  • A query. "MySQL 8.4, default sql_mode. Schema: [paste]. One SELECT giving paid orders and revenue per month of 2026, including months with none. Expected rows: [paste]."
  • An error. "MySQL 8.4 on Windows 11. Explain ERROR 1205 lock wait timeout on an UPDATE, how it differs from a deadlock, and which sys schema query shows who holds the lock."
  • A backup script. "MySQL 9.7 LTS on Windows 11, service MySQL97. A PowerShell script that dumps shop with mysqldump --single-transaction, keeps 14 days, plus the schtasks command for 02:00."
  • A slow plan. "MySQL 8.4. This query takes nine seconds and here is its EXPLAIN ANALYZE: [paste]. Which single index would help most, and why?"

Ask the AI

One prompt forces the version question into the open: "MySQL 8.4 LTS. You suggested mysqlpump. Check that against the 8.4 reference manual, link the page, and tell me what the manual recommends instead."

The verification habit

An answer is a draft from a clever colleague who has never logged into your server. Read it, run it on dev, check the result, then run it for real. For anything that writes, wrap it in a transaction, count the rows you expect to change, and compare that count with the rows affected. Read the WHERE clause of an UPDATE or DELETE before you run it, every time.

Illustration · Both
START TRANSACTION;
-- 1. how many rows should change? here: only order 12
SELECT COUNT(*) FROM orders
WHERE status = 'pending' AND order_date < '2026-03-01';   -- 1
-- 2. the assistant's statement, with the same WHERE clause
UPDATE orders SET status = 'cancelled'
WHERE status = 'pending' AND order_date < '2026-03-01';   -- 1 row affected
-- 3. counts match and a spot check looks right? COMMIT. Otherwise:
ROLLBACK;

The row count is your unit test. One row affected when you expected one row is a pass; five is a rollback and a better prompt. Autocommit is on by default in both engines, so without an explicit transaction the statement is final the moment it finishes (chapter 9). In the mysql client, --safe-updates refuses an UPDATE or DELETE with no key in its WHERE clause, which is a cheap seat belt for a dev session.

Remember

Websites teach querying. A local server teaches the job. An AI types the syntax. You own the WHERE clause.

What AI is bad at here, and how you catch it

Assistants are reliable about the SQL that has been written a million times: joins, aggregates, window functions, the shape of a procedure. Three things are a DBA's home turf and the model is guessing about all of them.

Where it slipsWhat it looks likeHow you catch it
Version-specific detailsSuggests mysqlpump (removed in 8.4), mysql_native_password (off in 8.4, gone in 9.0 and later) or CHANGE MASTER TO (removed in 8.4).Ask which version added or removed it and for the manual link, open it, check the version selector, then run it on dbfiddle.uk at your version.
Your dataAssumes customer_id is never NULL, forgets the ENUM has a cancelled value, guesses row counts, picks a join that duplicates rows.Paste the DDL and five sample rows with the expected output, then compare the rows and the counts you get.
Your privileges and environmentAssumes you are root, writes Linux paths and sudo -u postgres psql, grants more than the task needs.Name Windows 11, the service and the account in the prompt, run the answer as that account on dev, and read every GRANT against chapter 14.

Two habits cover most of it. Ask for the documentation link and open it, because the official manuals have a version selector. Then test on a server at your own version before you trust anything.

Reference shelf

Where to go for the truth rather than a summary. Bookmark the manual at your server's version.

Quick check

1. You want to check whether a query behaves the same on MySQL 8.4 and 9.7 before sending it to a colleague. Where do you run it?

The story games run SQLite in the browser, W3Schools' editor is not a MySQL server, and LeetCode runs MySQL 8.0. dbfiddle.uk offers MySQL 5.5 through 9.7 side by side. See "Sandboxes, playgrounds and the shop dataset".

2. An assistant wrote an UPDATE for you. What do you do before it touches production?

The verification habit is read, test on dev in a transaction, check counts, then run for real. Autocommit makes a statement final the moment it finishes, and the assistant cannot see your server at all. See "The verification habit".

3. Which of these is an AI assistant least reliable about?

Joins and window functions are written the same way in every tutorial, so assistants get them right. Version-specific details (mysqlpump removed in 8.4, mysql_native_password gone in 9.0+) are where they slip, and the fix is to ask for the manual link and test at your version. See "What AI is bad at here, and how you catch it".