Skip to content
Guide · Run SQL in your browser

Online SQL Editor & Compiler: Run SQL in Your Browser

Write a query, press Run and see the result straight away. This SQL online compiler runs SQLite inside your browser with two sample databases loaded, so you can practise SELECT, JOIN, GROUP BY, CTEs and window functions without installing anything or creating an account.

This editor runs SQLite (compiled to WebAssembly) in your browser, with a sample shop database loaded. Standard SQL such as SELECT, JOIN, GROUP BY, subqueries, CTEs and window functions works as written.

Examples:
Sample data: tables and columns

Loads with the engine.

Facts on this page checked 8 October 2026 against the official documentation. Versions covered: sql.js 1.14.2 (SQLite 3.49.1 compiled to WebAssembly). Next review due April 2027. The playground runs entirely in your browser; nothing you type or open is sent to CodeWithSQL.
Short answer
  • The editor above runs real SQLite in your browser through sql.js. There is no server behind it and no sign-up.
  • Two sample databases are built in: a shop (customers, products, orders, order_items) and an HR schema (departments, employees).
  • Run with the button or Ctrl+Enter (Cmd+Enter on a Mac), export the last result as CSV, and copy a share link that carries the query in the URL.
  • Changes live in memory only: reloading the page or pressing Reset data restores the sample data.
  • For PostgreSQL syntax use the PostgreSQL playground; for your own .sqlite files use SQLite online.
How we know: Written from the playground's own code and the official pages of the projects it uses (sql.js, SQLite, PGlite), checked on 8 October 2026. The example queries were written for the sample data shown on this page; follow the project documentation if a version changes.

How to use this SQL online compiler

  1. Type a query in the editor, or press one of the Examples buttons to load one.
  2. Press Run or Ctrl+Enter (Cmd+Enter on a Mac). Each statement that returns rows gets its own result table, and the status line shows how long it took.
  3. Use Download CSV to save the last result table, and Copy share link to copy a link with your query.
  4. Pick Sample data to switch between the shop and HR databases, or press Reset data to undo your changes.

The share link stores the query after #q= in the address itself; nothing is saved on our server. Opening the link fills the editor but does not run the query, so the person receiving it presses Run when ready. Result tables show up to 1,000 rows.

The sample databases

Both datasets are small enough to read in full, which helps when you are checking whether a query is right. Open Sample data: tables and columns under the editor to see the live list, including any tables you create.

Tables in the two sample datasets
DatasetTableColumns
Shopcustomerscustomer_id, name, email, country, signup_date
Shopproductsproduct_id, name, category, price
Shopordersorder_id, customer_id, order_date, status, total
Shoporder_itemsorder_id, product_id, quantity, unit_price
HRdepartmentsdept_id, name, location
HRemployeesemp_id, name, dept_id, manager_id, job_title, salary, hire_date

Example queries to try

Paste these into the editor. The first two use the shop data; switch Sample data to HR for the third. They are SQLite syntax, which follows standard SQL closely; substr is SQLite's spelling of a substring function.

SQLite, shop data: products over 30, most expensive first
SELECT name, category, price
FROM products
WHERE price > 30
ORDER BY price DESC;
SQLite, shop data: revenue per month with a CTE (returned orders excluded)
WITH kept AS (
  SELECT substr(order_date, 1, 7) AS month, total
  FROM orders
  WHERE status <> 'returned'
)
SELECT month, COUNT(*) AS orders, SUM(total) AS revenue
FROM kept
GROUP BY month
ORDER BY month;
SQLite, HR data: each employee with their manager (self join)
SELECT e.name, e.job_title, m.name AS manager
FROM employees e
LEFT JOIN employees m ON m.emp_id = e.manager_id
ORDER BY e.emp_id;

What it can and cannot do

The engine is SQLite compiled to WebAssembly by the sql.js project, which keeps the database in memory. That makes it quick and private, and it also sets the limits:

  • Nothing persists. Tables you create disappear when you reload. Keep queries you want in a share link or a file.
  • SQLite dialect. Engine-specific syntax such as TOP, SHOW TABLES, DUAL or stored procedures will not run. SQLite also uses dynamic typing, so a column's declared type does not stop other kinds of values being stored.
  • Not for large data. Everything sits in the browser tab's memory.

For other engines see PostgreSQL online (real Postgres in the browser), the MongoDB playground, and the guides to free ways of running MySQL, SQL Server and Oracle. To tidy a long query, use the SQL formatter.

Privacy: your SQL stays in your browser

The SQLite engine is loaded from this site as a file, then runs entirely on your device. The queries you type and the results they produce are not sent to CodeWithSQL or anywhere else. A share link contains the query text itself, so treat it like the query: anyone you send it to can read it.

To keep learning, work through the SQL exercises (each has a schema, sample data and an expected result you can reproduce here) or start the SQL beginner course.

All playground tools

Run SQL in your browser

Other databases online

SQL tools

Frequently asked questions

Is this SQL online editor free?

Yes. There is no account and nothing to install, and the playground sets no limit on the number of queries you run.

Which SQL dialect does it use?

SQLite. Standard SQL such as joins, subqueries, CTEs and window functions works as written. For PostgreSQL-specific syntax use the PostgreSQL playground.

Is it like SQL Fiddle or DB Fiddle?

It serves the same purpose: run a query against a small database and share it. Here the database runs in your own browser, and the share link holds the query in the URL rather than storing it on our side.

Can I create my own tables?

Yes. CREATE TABLE, INSERT, UPDATE and DELETE all work. Your tables last until you reload the page or press Reset data.

Can I open my own database file?

Yes, on the SQLite online page, which can open a .sqlite or .db file from your computer without uploading it.

Sources

Checked 8 October 2026.

How we research tool pages: our editorial method. The engines are open-source projects credited on each page.

Want structured practice?

Work through real problems with hints and solutions, or follow the beginner course.