☰ Learn SQL Tutorial Menu
Your Practice Database: A Guided Tour
Written by Faisal Adnan · Updated 16 Sept 2026 · 3 min read
Before writing any SQL, let's get familiar with the practice database that's automatically loaded every time you run a query in the Code Playground. Every example in this course uses it, so you can follow along by pasting queries directly into the playground.
The six tables
| Table | Columns |
|---|---|
departments | id, name, location |
employees | id, first_name, last_name, email, department_id, job_title, salary, hire_date, manager_id |
customers | id, customer_name, city, country, signup_date |
products | id, product_name, category, price, stock_quantity |
orders | id, customer_id, employee_id, order_date, status |
order_items | id, order_id, product_id, quantity, unit_price |
How the tables connect
- Each employee belongs to one department (
employees.department_id→departments.id). - Some employees are managed by another employee —
employees.manager_idpoints back to another row in the sameemployeestable (a "self-referencing" relationship). - Each order is placed by one customer and handled by one employee.
- An order can contain many products — that's what order_items is for: each row is one product on one order, with its own quantity and price.
Why it's reset every run
Each time you click Run, the practice database is dropped and reloaded fresh with the same sample data — so you can freely experiment with INSERT, UPDATE, and even DELETE without worrying about breaking anything permanently, or affecting other students. Every run starts clean.
Try it now
SELECT * FROM departments;
Open the Code Playground, pick any SQL engine (SQLite, PostgreSQL, MySQL, or SQL Server), and paste these queries in directly — the practice database above is already loaded for you, every time.
Lesson 2 of 27
Sign in to track your progress and earn XP for every lesson you finish.
Practice tip: the built-in code runner is being upgraded. Until it is back, copy the examples into any SQL or Python tool you have (for example SQLite, PostgreSQL, MySQL, SQL Server or a free online editor) and run them there. You can keep reading and earning XP here.
