SQL online editor: write and run queries in your browser

An SQL editor with nothing to install and no sign-up. Write a query, click Run and see the result as a table, on real practice data from an online shop and four more databases.

In short: pick a database, type a query or click an example, then press Run or Ctrl+Enter. Every run starts from the original data, so you cannot break anything. Nothing is stored on the server; only your browser remembers the query you are working on.

The database of the SQL course: a small online shop for office supplies with customers, products, employees, orders and order items.

customers 12 rows, 7 columns
  • INTEGER Primary key
  • TEXT
  • TEXT
  • TEXT
  • TEXT
  • TEXT
  • TEXT
products 12 rows, 5 columns
  • INTEGER Primary key
  • TEXT
  • TEXT
  • REAL
  • INTEGER
employees 10 rows, 7 columns
  • INTEGER Primary key
  • TEXT
  • TEXT
  • TEXT
  • REAL
  • TEXT
  • INTEGER
orders 18 rows, 5 columns
  • INTEGER Primary key
  • INTEGER Foreign key, points to customers.customer_id
  • TEXT
  • TEXT
  • INTEGER Foreign key, points to employees.employee_id
order_items 38 rows, 4 columns
  • INTEGER Primary key Foreign key, points to orders.order_id
  • INTEGER Primary key Foreign key, points to products.product_id
  • INTEGER
  • REAL

Example queries to click

One click loads the query into the editor and runs it. Then change it: drop a column, add a condition, sort the other way. That teaches you more than an empty box.

How to use the SQL editor

  1. Pick a database. The default is the shop from the SQL course. Below it you see every table with its columns, data types and row count.
  2. Write a query. Tap a table or column name to insert it at the cursor. That saves typos, especially on a phone.
  3. Run it. Use the button or Ctrl+Enter (Cmd+Enter on a Mac). The result appears as a table; for long results you see the first 100 rows and the total.
  4. Read the error. If something is wrong, the message below the editor points to the cause: a misspelled column with a suggestion, a comma before FROM, text without quotes.

Try changing data

The editor also accepts INSERT, UPDATE, DELETE, CREATE TABLE and CREATE VIEW. Each run works on a fresh copy of the data that disappears afterwards. To see the effect of a change, put a query after it, separated by a semicolon, like the example above: UPDATE first, then SELECT. Up to ten statements run in one go, including BEGIN and ROLLBACK.

Which SQL runs here?

The editor uses SQLite, like the exercises in the course. The core commands are written the same way in MySQL, PostgreSQL and SQL Server: SELECT, WHERE, GROUP BY, JOIN, subqueries, WITH and window functions. The main differences are date functions and how you limit rows. See MySQL vs PostgreSQL vs SQL Server for an overview.

For security there are a few limits: at most 4,000 characters and ten statements per run, no recursive queries, no commands such as ATTACH or PRAGMA, and only the usual functions for text, numbers, dates and aggregates. Queries that would combine a huge number of rows, such as several tables joined without ON, are stopped before they run.

The databases

  • Shop: the office supplies shop from the course with customers, products, employees, orders and order items.
  • Sales list: one table with every sale, good for GROUP BY before JOIN.
  • Analytics, Finance, Marketing: the data of the intensive courses, with more rows and tables for KPIs, budget vs actual and campaigns.

All databases can also be downloaded for SQLite, MySQL and PostgreSQL: download the SQL sample database.

From trying things to knowing them

A free editor is great for trying things out. To make it stick, exercises with a check help: the SQL practice exercises tell you whether your result is right, also on other data, and give hints when you are stuck. New tasks at the push of a button are in the random SQL exercises, and every command is in the SQL commands cheat sheet.

Frequently asked questions

Is the online SQL editor free?

Yes. You need no account and nothing to install. To keep the server healthy there is a limit of 300 runs per hour, which you will not notice during normal practice.

Can I create my own tables or upload my own data?

You can create tables with CREATE TABLE, but they only exist for one run. Uploading your own data is not possible. For your own projects, download the sample database and continue locally, for example with SQLite.

Is my query saved?

Not on the server. Your browser remembers the query per database so it is still there after a reload. Clear removes it.

Does the editor work on a phone?

Yes. Insert table and column names with the buttons above the input field, and swipe sideways through wide results.

Why does LIMIT work but not TOP?

TOP only exists in SQL Server. SQLite, MySQL and PostgreSQL limit rows with LIMIT at the end of the query. The editor's error message tells you that as well.

Prefer a step-by-step path?

The SQL course starts from zero and takes you through short lessons with exercises up to JOIN, window functions and your own tables.

Start with lesson 1

Write to us

Choose language

Select your preferred language