SQL Query Playground

A free SQL editor that runs SELECT queries on any CSV file inside the browser. No database to install, no upload and no account, so a class can write its first query in the first minute. With a feature list, known differences from SQLite and ideas for class.

Web toolBachelor +2CC BY 4.0

What you will learn

  • Write SELECT queries with WHERE, GROUP BY, HAVING and ORDER BY
  • Ask questions of a real CSV file without setting up a database
  • Read an error message and find the part of the query it is about
  • Know where the playground behaves differently from a full database

What it does

  • Loads a CSV file from your device, or a built-in sample table of 30 orders (click Try sample data). The table is called data.

  • Runs SELECT queries with DISTINCT, WHERE (including LIKE, IN, BETWEEN and IS NULL), GROUP BY, HAVING, ORDER BY, LIMIT and OFFSET, and the aggregates COUNT, SUM, AVG, MIN, MAX and GROUP_CONCAT.

  • Works out each column's type from its values, so number comparisons and sums behave as expected.

  • Runs entirely in the page. The file is never uploaded, and nobody needs an account, which keeps it usable in schools with strict data protection rules.

Getting data in

Drop a CSV file onto the page, choose one, paste the text, or click Try sample data. Under Options you can set the delimiter (detected automatically, or comma, semicolon, tab or pipe), say whether the first row holds the column names, and edit the raw data. The Columns list shows every column with the type the playground found (number, date, text and so on); click a name to add it to the query.

Writing and running queries

  • The query runs again a moment after you stop typing, so the result is always up to date. Run or Ctrl+Enter (Cmd+Enter on a Mac) runs it at once.

  • The Try links load five example queries: Everything, Filter, Group and total, Having and Text search.

  • The result can be copied, or downloaded as query-result.csv.

  • Besides the aggregates, there are functions for text and numbers: LOWER, UPPER, TRIM, LENGTH, SUBSTR, REPLACE, ROUND, ABS, COALESCE and IFNULL. || joins text: customer || ' (' || company || ')'.

  • Column names with spaces go in double quotes, square brackets or backticks: "order date".

What it leaves out

It queries one table. JOIN, UNION and window functions are rejected with a clear error that names the missing feature, and so is anything that writes data (INSERT, UPDATE, DELETE, CREATE). A subquery, such as WHERE revenue > (SELECT AVG(revenue) FROM data), stops with a syntax error instead. CASE expressions and date functions such as strftime are not available either; for months, SUBSTR(date, 1, 7) turns 2026-01-04 into 2026-01. That makes it a good first step before a full database system, not a replacement for one.

Where it differs from SQLite

Learners who move on to the SQL sandbox, which runs real SQLite, will notice a few differences:

In the playground

In SQLite

country = 'germany' finds Germany: = ignores upper and lower case

= is case-sensitive; 'germany' finds nothing

An empty cell counts as NULL, so IS NULL finds it

An empty text and NULL are different

FROM data can be left out, and the table can have any name

The table name must be right

GROUP BY needs the expression itself, not its alias

GROUP BY can use an alias

No subqueries, joins or CASE

All available

ORDER BY and HAVING can use an alias in both: HAVING orders > 2 works.

A first query

First query
SELECT country, COUNT(*) AS orders
FROM data
GROUP BY country
ORDER BY orders DESC

On the sample data this lists nine countries: Germany first with 6 orders, then the Netherlands and the United States with 5 each.

A second step: the share of each channel in paid revenue. Paid revenue is 9,469 in total.

Share of paid revenue by channel
SELECT channel, ROUND(SUM(revenue) * 100.0 / 9469, 1) AS share
FROM data
WHERE status = 'paid'
GROUP BY channel

Direct 48.2 percent, Marketplace 26.1 percent, Partner 25.7 percent.

Reading error messages

The playground names the problem in plain words. The ones learners meet first:

  • No such column: contry. The name is misspelt, or an alias was used in GROUP BY. Check the Columns list.

  • Expected BY but found country. GROUP or ORDER without BY. "Expected ... but found ..." always names what is missing.

  • Query ended unexpectedly. The query stops too early, for example right after WHERE or ORDER BY.

  • Unclosed call to SUM(). A closing bracket is missing.

  • JOIN is not supported, this engine queries a single table. The feature exists in SQL, but not here. Use the SQL sandbox for joins.

One mistake gives no error at all: a missing comma. SELECT country revenue FROM data shows the country column under the heading "revenue", because a name right after a column counts as its alias. SQLite does the same. If a column seems to be missing from the result, look for a missing comma.

Ideas for class

  • A first SQL lesson. The 45-minute exercise on sales data has six tasks with solutions.

  • Open data. Download a CSV from an open data portal and let learners ask their own questions of it.

  • Spreadsheet versus SQL. Answer the same question once with a pivot table and once with a query, then compare which one you could still read a week later.

  • Ten questions, ten queries. The sample orders dataset has ten tasks with checked answers that all run in the playground.

  • Next step. Move to the SQL sandbox for joins across several tables, subqueries and creating tables.

Using this page

The tool is free to use. This description and the ideas on it are licensed under CC BY 4.0.

Reuse this material

CC BY 4.0

You may copy, adapt and share it, also commercially, as long as you credit ManyPI and link back.

"SQL Query Playground" by ManyPI (https://manypi.com/edu/sql-query-playground), licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)