SQL Sandbox
A real SQL database running in your browser. Type any SQL, press Run, see the result. Nothing you do here can break anything.
How it works: pick a starting point below. Empty database gives you a blank database to build your own tables from scratch. Shop database loads the online art shop from A3.3 Database Programming. Your tables, data and SQL are saved in your browser, so they are still there when you come back. Run several statements at once by ending each with
;. Shortcut: Ctrl+Enter.
Tables
Your database right now. Click a table name to see all its rows. Underlined = primary key, red italic = foreign key.
Loading database...
Editor
Results appear here.
Examples to try
These use the shop tables, so switch to Shop database first. Click one to load and run it.
Challenges
Use the shop database. Write these yourself. Answers are in the A3.3 practice exercises.
- List every customer in France, sorted by city.
- Show every item that costs less than 30, with the name of the artist who made it.
- Count how many customers there are in each country.
- Find the total quantity sold of each item.
- Find the items that have never been bought.
- Add yourself as a customer, then record a purchase for yourself.
- Create a table
Reviewwith a review ID, an item ID (foreign key) and a star rating, then insert two reviews.
Ninja Notes:
- This is SQLite. It has no
TRUNCATE,GRANTorREVOKE(no user accounts), but everything else in the syllabus works. - Foreign keys are switched on, so you cannot add an item for an artist that does not exist.
- Text and dates go in single quotes:
'France','2025-07-28'. - Broke the data? Press Reset database. Want to keep your work? Press Download .sqlite.
- Your database is saved only in this browser. Clearing site data or a private window will lose it.