SQL Sandbox Learn SQL by watching it run
Starting… no database
Try
Ctrl Space shows suggestions. Select part of the script to run only that.
Results
Supported SQL
  • CREATE / DROP DATABASE, USE, SHOW DATABASES, SHOW TABLES, DESCRIBE table
  • CREATE TABLE with INT, DECIMAL, VARCHAR(n), TEXT, DATE, BOOLEAN, PRIMARY KEY, AUTO_INCREMENT, NOT NULL, UNIQUE, DEFAULT
  • ALTER TABLE add, drop or rename; DROP TABLE, TRUNCATE
  • INSERT (several rows at once), UPDATE … WHERE, DELETE … WHERE
  • SELECT with DISTINCT, WHERE, JOIN (INNER, LEFT, RIGHT, CROSS), GROUP BY, HAVING, ORDER BY, LIMIT/OFFSET
  • Subqueries: derived tables FROM/JOIN (SELECT …) AS t, UNION / UNION ALL, and IN, EXISTS or scalar subqueries in expressions (correlated ones too)
  • Expressions: AND OR NOT LIKE IN BETWEEN IS NULL CASE, arithmetic, and functions such as COUNT SUM AVG MIN MAX ROUND UPPER LOWER LENGTH COALESCE CONCAT SUBSTR
  • Export SQL writes a .sql file with or without data, with optional DROP, IF NOT EXISTS and foreign keys. Import SQL reads one back (or a MySQL dump) with options for the target database, replacing tables and error handling.
  • Tabs and shortcuts: each tab keeps its own editor, results and history. Alt+T new tab, Alt+D duplicate, Alt+W close, Alt+1…9 switch. Results can be downloaded as CSV, and any history line can be run again with its ▶ button.
  • Separate statements with semicolons. A script stops at the first error, as a real client does.