The demo database
Five small tables that every example in this tutorial runs against. Keep this page open in a second tab while you learn.
The demo database
Every example in this tutorial runs against these five tables. They are small enough to read in full, which makes it easy to check whether a query gave you the right answer.
Nothing is saved — reload the page and the data is back to normal, so experiment freely.
Customers
Who buys from us. Note that Bose Logistics has a NULL Segment, and has never placed an order — both deliberate, for the NULL and LEFT JOIN lessons.
Orders
One row per order. CustomerID links back to Customers.
Products
OrderItems
The lines within each order. This is what links Orders to Products, and it is why some joins need three tables.
Employees
ManagerID points at another row in this same table — that is what makes a self join possible.
Try any query you like
What this playground supports
It is a teaching engine, not a real database. It handles:
SELECT,DISTINCT,AS,*WHEREwith=<>><>=<=,AND,OR,NOT,IN,BETWEEN,LIKE,IS NULLINNER JOINandLEFT JOIN, including self joins and three or more tablesGROUP BY,HAVING,ORDER BY,LIMITandTOPCOUNT,SUM,AVG,MIN,MAX,ROUND,UPPER,LOWER,LENGTH,CONCAT
Subqueries, window functions, INSERT, UPDATE and date functions are not supported — you will meet those on the full course, on a real SQL Server.
Want this taught properly?
This tutorial covers the basics. Our SQL course in Noida takes you through window functions, CTEs and stored procedures on a real database, with projects and mentor support.
See the SQL course →