Auto-grade SQL queries in Moodle with an instant Tables schema viewer.
Each student runs queries against a fresh, isolated MariaDB/MySQL database initialized from your hidden setup script. One click on Tables shows every table, column type, PK/FK badge, relation, and sample rows, and one more click turns them into an interactive ER diagram.
Fresh MariaDB database
Students can run SELECT, INSERT, UPDATE, DELETE, and JOIN freely without affecting anyone else — every execution starts from a clean copy of your setup SQL.
Built-in Tables viewer
No more scrolling back up to remember column names. The Tables button parses your setup DDL/DML and displays schema cards with PK/FK tags and sample rows in Light and Dark mode.
Unordered row comparison
Enable unordered comparison when row order does not matter, or require exact ordering for ORDER BY tasks. Students can compare their answer side-by-side with the model query in review.
Interactive ER diagram, synced with the SQL code
From SQL to diagram
The Tables | ER diagram switcher draws the schema in Crow's Foot or Chen notation from CREATE TABLE and ALTER TABLE. Tables from the hidden setup are locked; students add their own tables that refer to them.
From diagram to SQL
Add tables, columns and relationships (1:1, 1:N, N:M with an automatic junction table) visually. Only the changed statement is rewritten, with Undo/Redo; comments, INSERT data and queries stay untouched.
Made for teaching
The diagram highlights the tables and joins of the student's query, warns about design mistakes such as a table without a primary key, and exports to SVG or PNG. Teachers design the schema in the same editor.
SQL tools for teaching
Help while typing
Completion knows the tables, including the hidden ones: after b. only the columns of book. 29 common MariaDB errors are explained for beginners in 29 languages, with a link to the line.
Step by step and Plan
Step by step shows a SELECT in the order the database works it out (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY), with the table after each step. Plan explains full reads and index use from ANALYZE.
Transactions
Two sessions on one database side by side: run START TRANSACTION and UPDATE in A, watch B wait for the lock, then COMMIT or ROLLBACK.
Relational algebra
Write π[title](σ[year > 1950](book)) with symbol buttons and see the SQL it becomes and its result on the tables of the example.
Data and schema
Generate realistic sample rows, import a CSV file as a table, and see views, triggers and procedures in the ER diagram.
Stronger grading
Each test of a SQL question can bring its own data, INSERT/UPDATE/DELETE answers are graded by the state of the database, and feedback lists missing and extra rows.
Ready-to-import SQL starter pack
Download our SQL & Databases Moodle XML pack (8 verified questions covering SELECT, WHERE, GROUP BY, HAVING, JOIN, and subqueries) or test SQL live on our Moodle demo site.