PostgreSQL online compiler

A real PostgreSQL 18 server in your browser, with psql commands. Runs in your browser.

Learn PostgreSQL →
query.sql
-- Online PostgreSQL (a real Postgres 18 running in your browser)
-- Sample tables: customers, products, orders.  Try \dt or \d orders

SELECT category,
       count(*)                              AS products,
       round(avg(price), 2)                  AS avg_price,
       string_agg(name, ', ' ORDER BY name)  AS names
FROM products
GROUP BY category
ORDER BY products DESC;
Output

Press ▶ Run or Ctrl/⌘ + Enter to run your code.

Sample tables: customers, products, orders. psql commands like \dt and \d orders work too.