Postgres Lab Starting database… Playground

PostgreSQL playground

Run any SQL on a live PostgreSQL 16 database: several statements at once, DDL, transactions, PL/pgSQL. The sample shop tables are ready to query. Changes stay until you reload or reset the database.

SELECT c.name, count(o.id) AS orders
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id
GROUP BY c.name
ORDER BY orders DESC;