Skip to main content

SQL Terminal Simulator

Practice SQL in an interactive browser terminal. Learn SELECT, WHERE, ORDER BY, DISTINCT, aggregates, GROUP BY, HAVING, JOINs, subqueries, and window functions against a small e-commerce schema, with single-table queries evaluated live and verified Postgres output.

Category: Database

What You Will Learn

  • Write SELECT queries and project only the columns you need
  • Filter rows with WHERE using comparison operators and LIKE
  • Sort and cap results with ORDER BY, DESC, and LIMIT
  • Summarise data with count, sum, avg, min, max, GROUP BY, and HAVING
  • Combine tables with JOINs and keep unmatched rows with LEFT JOIN
  • Change data with INSERT, UPDATE, and DELETE and read their command tags
  • Compare rows against a subquery and name subqueries with WITH (CTEs)
  • Rank rows within groups using window functions
  • Test yourself in Challenge mode by writing queries from a plain-English prompt

Topics covered: sql, postgres, postgresql, database, queries, select, joins, aggregates, terminal, backend, educational, interactive

// simulator

SQL Terminal Simulator

Practice SQL in an interactive browser terminal. Learn SELECT, WHERE, ORDER BY, DISTINCT, aggregates, GROUP BY, HAVING, JOINs, subqueries, and window functions against a small e-commerce schema, with single-table queries evaluated live and verified Postgres output.

Supported byDigitalOceanDevDojoSMTPfastQuizAPIBecome a sponsor

// sql playground

SQL Terminal Simulator

Practice SQL against a small e-commerce schema in a safe browser terminal. Single-table queries run live; the guided join, subquery, window, and CTE lessons return real Postgres output. Learn SELECT, WHERE, ORDER BY, DISTINCT, aggregates, GROUP BY, HAVING, JOINs, LEFT JOIN, INSERT/UPDATE/DELETE, subqueries, window functions, and CTEs.

Progress0/18

4

Tables

50

Rows

13

Lessons

Lessons
Lesson 1 / 13
Step 1 / 2

Return every column and row from the customers table.

psql
devops=#

Welcome to the SQL terminal playground (Postgres-style).

Type "help", run "\dt" to see the tables, or follow the current task above.

devops=#
Schema

customers

8 rows
  • customer_idint
  • nametext
  • countrytext
  • signup_datedate

products

10 rows
  • product_idint
  • nametext
  • categorytext
  • pricenumeric

orders

12 rows
  • order_idint
  • customer_idint
  • order_datedate
  • statustext

order_items

20 rows
  • item_idint
  • order_idint
  • product_idint
  • quantityint
Cheat sheet

SELECT columns to read

WHERE filters rows

GROUP BY + aggregates summarise

HAVING filters groups

ORDER BY / LIMIT sort and cap

JOIN / LEFT JOIN combine tables

INSERT / UPDATE / DELETE change data

WITH names a subquery (CTE)

About this SQL simulator

What you'll learn

  • How SELECT reads rows and how to project specific columns
  • How WHERE filters rows with operators like =, <, >, <>, and LIKE
  • How ORDER BY, ASC/DESC, and LIMIT shape a result set
  • How DISTINCT and the aggregates count, sum, avg, min, and max summarise data
  • How GROUP BY buckets rows and HAVING filters those groups
  • How JOINs, LEFT JOINs, subqueries, and window functions work across tables
  • How INSERT, UPDATE, and DELETE change data, and how CTEs (WITH) name a subquery

Key statements covered

  • Read: SELECT, SELECT DISTINCT, column projection, table.column prefixes, AS aliases
  • Filter: WHERE with AND/OR, comparison operators, LIKE, and numeric vs string literals
  • Aggregate: count, sum, avg, min, max, round, GROUP BY, HAVING
  • Shape: ORDER BY, LIMIT
  • Relate: JOIN, LEFT JOIN, subqueries, WITH (CTEs), and rank() window functions
  • Write: INSERT, UPDATE, DELETE and their psql command tags

How the playground runs your queries

Single-table SELECT queries are evaluated live in your browser against a small e-commerce schema (customers, products, orders, order_items). The guided join, subquery, and window lessons return output captured from a real PostgreSQL instance, so the results you see match what Postgres actually returns. Nothing is sent to a server, so you can experiment freely.

Practice on real Postgres

A simulator is a great place to build intuition, but running these queries against a real database makes them stick. You can spin up a free Postgres in seconds with Neon and paste the same queries in to run them for real, or run managed PostgreSQL on DigitalOcean (new accounts get $200 in credits). Load a table or two, then re-run the lessons here against your own data.

Related reading

Once the queries click, these deep dives cover the schema and query patterns that keep a Postgres database fast as it grows:

Why learn SQL this way?

  • SQL clicks fastest when you can change a query and immediately see the rows change.
  • The same handful of clauses (SELECT, WHERE, GROUP BY, JOIN) cover most day-to-day queries.
  • Reading real result sets builds the instinct you need for reports, debugging, and interviews.

Try next

Sponsored
Carbon Ads
$ cd /games
// share