PostgreSQL Online Compiler

About the PostgreSQL compiler

Advanced open-source relational database. Run PostgreSQL code in your browser with no install and no signup — the editor, the input and the output share one screen. PostgreSQL compiles and runs on your own device through WebAssembly, so once the page has loaded it keeps working without a network connection.

Press Run to execute the program, edit it and press Run again, or paste your own code over it. Everything you type stays in the page; the editor caches your work locally so a reload does not lose it.

A PostgreSQL example

This is the program the PostgreSQL editor opens with — run it as it is, then change it.

-- PostgreSQL: Advanced SQL with CTEs and window functions
CREATE TABLE employees (
    id SERIAL PRIMARY KEY,
    name VARCHAR(100),
    department VARCHAR(50),
    salary NUMERIC(10,2),
    hire_date DATE
);
INSERT INTO employees (name, department, salary, hire_date) VALUES
    ('Alice', 'Engineering', 95000, '2020-01-15'),
    ('Bob', 'Engineering', 88000, '2021-03-20'),
    ('Charlie', 'Marketing', 72000, '2019-06-10'),
    ('Diana', 'Marketing', 78000, '2020-09-01'),
    ('Eve', 'Sales', 65000, '2022-01-05');
-- CTE with window function
WITH dept_stats AS (
    SELECT
        department,
        COUNT(*) as headcount,
        AVG(salary)::NUMERIC(10,2) as avg_salary
    FROM employees
    GROUP BY department
)
SELECT

The editor opens with the full program.

More Databases compilers

Browse all 109 languages — the same editor runs each of them, in the browser or on a shared runner.