Skip to main content

Online SQL Editor.

Compose and document SQL queries with a focused editor—ideal for reviews and teaching.

Need custom conversion?

Completions appear as you type; press Ctrl+Space to open the list. Tab expands snippets where available. Find: Ctrl+F (Cmd+F on Mac). Format: toolbar button or Ctrl+Shift+B for supported languages.

Choose editor font size in pixels

Compose and document SQL queries with a focused editor—ideal for reviews and teaching.

Related technologies: PostgreSQL, MySQL, dbt, CSV imports — see also MySQL Editor, PostgreSQL Editor, SQL Server Editor.

Starter snippet

WITH recent AS (
  SELECT user_id, MAX(created_at) AS last_seen
  FROM events
  GROUP BY user_id
)
SELECT u.id, u.email, r.last_seen
FROM users u
JOIN recent r ON r.user_id = u.id;

Filtered SELECT

-- SQL
SELECT id, email, created_at
FROM users
WHERE active = TRUE
  AND created_at >= CURRENT_DATE - INTERVAL '7 days'
ORDER BY created_at DESC
LIMIT 50;

JOIN + aggregate

SELECT u.id, COUNT(o.id) AS orders
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
GROUP BY u.id
HAVING COUNT(o.id) > 0;

Window function

SELECT id,
       amount,
       SUM(amount) OVER (PARTITION BY user_id ORDER BY created_at) AS running
FROM payments;

Variables

DECLARE @count INT;  -- dialect-specific

Loops

WHILE @i < 10 BEGIN ... END

Functions / methods

CREATE FUNCTION fn_slug(@s NVARCHAR(100)) RETURNS NVARCHAR(100) AS ...

Comments

-- line  /* block */

Variables (session)

-- SQL
SET @limit = 100;
PREPARE stmt FROM 'SELECT * FROM t LIMIT ?';

Conditional filters

SELECT *
FROM products
WHERE (:category IS NULL OR category = :category)
  AND price BETWEEN :min AND :max;

Reporting query with CTE

-- SQL: staged report
WITH daily AS (
  SELECT DATE(created_at) AS d, COUNT(*) AS n
  FROM events
  GROUP BY 1
)
SELECT d, n, SUM(n) OVER (ORDER BY d) AS running
FROM daily
ORDER BY d DESC
LIMIT 30;

Safe migration sketch

-- SQL: additive change
BEGIN;
  ALTER TABLE users ADD COLUMN IF NOT EXISTS locale TEXT;
  UPDATE users SET locale = 'en' WHERE locale IS NULL;
COMMIT;

Does SQL code run on ConversionTab servers?
No. Editing happens in your browser. Download the file and run it in your usual compiler, runtime, or platform.
Can I change theme and font size?
Yes. Use the toolbar above the editor; choices persist in local storage for your browser profile.