How to run MySQL online
- Start from a sample database (Employees or Shop) or an empty one, and look at its tables on the Schema tab.
- Write your queries and press Run SQL or Ctrl + Enter. Each statement gets its own result table; select part of the code to run only that.
- Every MySQL run starts from the sample database and runs the whole editor, so keep your
CREATE TABLEandINSERTstatements there. - Export any result as CSV, or press Share to copy a link with your queries.
- Stuck on a query? Generate writes SQL from a description, Explain walks through your query, Fix Code repairs errors and Optimize makes a query faster and clearer.
SQLite, PostgreSQL or MySQL?
| SQLite | PostgreSQL | MySQL | |
|---|---|---|---|
| Best for | Learning SQL, quick tests, interviews | Practising the SQL of a real server: window functions, JSON, strict types | Practising MySQL itself: AUTO_INCREMENT, LIMIT, procedures |
| Start time | Instant | A few seconds on the first run (it downloads about 3 MB) | Instant (it runs on our server) |
| Types | Flexible: any value fits any column | Strict: INTEGER, NUMERIC, DATE, JSONB and more | MySQL types: INT, VARCHAR, DECIMAL, DATETIME, JSON |
| Runs on | Your browser, with no account and no server | Our MySQL 8.4 server, in a private database deleted after each run | |
Prefer a database that runs in your browser? The SQL Online Compiler has SQLite and PostgreSQL too.
Good to know
- It runs on MySQL 8.4:
AUTO_INCREMENT, backtick quotes,LIMIT,SHOW TABLESandDESCRIBEwork as they are. - Stored procedures and triggers work with
DELIMITER //, as in the mysql client. - A run can take up to 10 seconds and change up to 50,000 rows; each result shows its first 1,000 rows.
- Each run uses a private database that is deleted right after; your SQL stays in this browser.
- Import a .sql or .csv file: it goes into the editor and runs with it.
- Switch Engine to SQLite or PostgreSQL to try the same query on another database.
MySQL queries to try
- Auto-increment table:
CREATE TABLE notes (id INT AUTO_INCREMENT PRIMARY KEY, body VARCHAR(200)); - Top rows:
SELECT name, salary FROM employees ORDER BY salary DESC LIMIT 3; - One list per group:
SELECT department_id, GROUP_CONCAT(name SEPARATOR ', ') FROM employees GROUP BY department_id; - Format a date:
SELECT name, DATE_FORMAT(hired_on, '%M %Y') FROM employees; - Look at the tables:
SHOW TABLES; DESCRIBE employees;
Frequently asked questions
Is this a real MySQL server?
Yes. Your queries run on MySQL 8.4, so MySQL syntax works as it is: AUTO_INCREMENT, backtick quotes, LIMIT, SHOW TABLES, DESCRIBE, GROUP_CONCAT, DATE_FORMAT, stored procedures and triggers.
Are my tables kept?
Each run gets a fresh, private database that is deleted right after, so nobody else can see your tables. Your SQL is kept in this browser.
Why are my tables gone on the next run?
Every run starts from the sample database and runs everything in the editor. Keep your CREATE TABLE and INSERT statements in the editor; imported files are added there too.
What are the limits?
A run can take up to 10 seconds and insert, update or delete up to 50,000 rows, and each result shows up to 1,000 rows. That is plenty for learning, homework and interview practice.
Can I write stored procedures and triggers?
Yes. Use DELIMITER // and end the procedure with //, as in the mysql command-line client. CALL runs it and shows its results.
Is it free?
Yes. The MySQL editor, the sample databases and the CSV export are free and need no account.
Related tools
- SQL Online Compiler: Run SQLite and PostgreSQL QueriesRun SQL online in your browser with SQLite or PostgreSQL. Sample databases, schema view, one result table per query, CSV import and export. Free, no sign-up.
- Online IDE: Run and Debug Code in 14 LanguagesFree online IDE for Python, Java, C, C++, C#, JavaScript and 8 more languages, plus SQL and Matplotlib charts. Run and debug code, use several files, save and share. No install.
- AI Code Checker: Explain and Fix Code OnlinePaste your code and let AI explain it in plain language or find and fix bugs. Python, C++, Java, JavaScript and 9 more languages. Free account.