☰ Learn SQL Tutorial Menu

Your Practice Database: A Guided Tour

Written by CSA mentors · 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

TableColumns
departmentsid, name, location
employeesid, first_name, last_name, email, department_id, job_title, salary, hire_date, manager_id
customersid, customer_name, city, country, signup_date
productsid, product_name, category, price, stock_quantity
ordersid, customer_id, employee_id, order_date, status
order_itemsid, 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_id points back to another row in the same employees table (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 learning points for every lesson you finish.

Example

-- A ready-to-query practice database is loaded automatically before every run —
-- no CREATE TABLE needed. Available tables:
--   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)

SELECT * FROM employees WHERE department_id = 1;
Try it Yourself »