Starting Postgres in your browser…

Your first query

Every query starts with SELECT (which columns you want) and FROM (which table they live in). * means every column.

Press Run (or Ctrl+Enter) to see every customer in the shop.

Ctrl+Enter to run

Pick your columns

In real code, list the columns you need instead of using *. It makes the query easier to read, and it won't break or slow down when someone adds a column later.

Ctrl+Enter to run

Filter with WHERE

WHERE keeps only the rows that match a condition. Text values go in single quotes. Combine conditions with AND and OR.

Ctrl+Enter to run

Sort and limit

ORDER BY sorts the results (DESC for largest first), and LIMIT caps how many rows come back. Without ORDER BY, Postgres can return rows in any order it likes.

Ctrl+Enter to run

Try it

exercise List the name and price of every product that costs less than $30, cheapest first.

Ctrl+Enter to run