query.sql
Loading editor…

Press Run to see each query’s result as a table.

Ready · press RunLn 1, Col 1PostgreSQL · in your browser

PostgreSQL

PostgreSQL online compiler

Run PostgreSQL queries in your browser and read each result as a table.

About this PostgreSQL compiler

This page runs a real PostgreSQL engine inside your browser, so you can practise SQL without installing a database or signing up for one. Write a script, press Run, and each query's result appears as a table you can export as CSV, with the tables and columns you created listed beside the editor. PostgreSQL features such as SERIAL, RETURNING, JSON, window functions and common table expressions work as they do on a server. Every run starts from an empty database and runs your whole script, so the result is always the same for the same script.

Questions and answers

Is this MySQL?
No. This is PostgreSQL. Most everyday SQL is the same in both, but MySQL-only syntax such as AUTO_INCREMENT or backtick-quoted names will not work here. For those, use SERIAL and double quotes.
Where is my data stored?
Only in your browser's memory, for as long as the page is open. Each run starts from an empty database, and nothing is sent to a server.
Why does the first run take a moment?
The PostgreSQL engine is a few megabytes and is downloaded the first time you press Run. Runs after that are immediate.
Can I connect to my own database?
No. The page is for learning and trying queries against data your script creates.