PublicSoftTools

SQL Query Tester — Practice SQL Online

Run SQL SELECT queries on sample tables directly in your browser. Practice WHERE filters, ORDER BY sorting, LIMIT, and aggregate functions like COUNT and SUM against realistic data. No install or signup needed, runs entirely in your browser.

Tables: users (id, name, age, city, dept)products (id, name, price, category, stock)orders (id, user_id, product_id, quantity, total, date)
Ctrl+Enter to run

How to Use the SQL Query Tester

  1. 1Pick one of the sample tables — users, products, or orders — as your FROM target.
  2. 2Write a SELECT query with WHERE filters, ORDER BY, LIMIT, or aggregates like COUNT and SUM.
  3. 3Press Run (or Ctrl/Cmd+Enter) to execute against the in-browser engine.
  4. 4Read the result table, or the red error message if the syntax is off.

Worked Example: Building a Top-N Query Step by Step

Start simple: SELECT * FROM products returns every column and row. Narrow it to expensive items with a filter: SELECT name, price FROM products WHERE price > 50. WHERE runs first, keeping only rows that pass the test. Now rank them: add ORDER BY price DESC to put the priciest at the top, and cap the output with LIMIT 3. The finished query — SELECT name, price FROM products WHERE price > 50 ORDER BY price DESC LIMIT 3— returns the three most expensive products over $50.

The order clauses execute in is the thing to internalise: WHERE filters rows, then ORDER BY sorts what survived, then LIMIT slices off the top of that sorted set. Swap in COUNT(*) or AVG(price) to collapse many rows into one summary number instead. And remember the classic gotcha the FAQ flags — WHERE city = NULL never matches anything, because nothing equals NULL; you need IS NULL. Practising these against fixed sample data is the fastest way to build query intuition before you touch a real database.

SQL Query Tips

Use aliases for readability

Although aliases are not currently parsed, plan for them: SELECT COUNT(*) AS total_orders FROM orders. Aliases make result columns self-documenting, especially for aggregates.

Filter before aggregating

WHERE filters rows before aggregation runs. To filter after aggregation you need HAVING (not yet supported). For example: SELECT category, COUNT(*) FROM products WHERE price > 50 counts expensive items by category.

Combine ORDER BY and LIMIT

Top-N queries are common: SELECT * FROM products ORDER BY price DESC LIMIT 3 returns the three most expensive products. Always pair ORDER BY with LIMIT when you want a ranked subset.

Understand NULL behaviour

NULL is not equal to anything, including itself. In SQL, NULL = NULL is not TRUE — you need IS NULL or IS NOT NULL. This is a common source of bugs for new SQL developers.

Frequently Asked Questions

What SQL features are supported?

The tester supports SELECT with column lists or *, FROM a single table, WHERE with single conditions (=, !=, >, <, >=, <=, LIKE), ORDER BY with ASC/DESC, LIMIT, and aggregate functions COUNT(*), SUM, AVG, MAX, MIN.

What sample tables are available?

Three tables: users (id, name, email, age, city), products (id, name, category, price, stock), and orders (id, user_id, product_id, quantity, total, status). These are static in-memory tables — changes are not persisted.

Does LIKE support wildcards?

Yes. LIKE supports the % wildcard (matches any sequence of characters). For example: WHERE name LIKE '%son' matches names ending in "son". Case-insensitive matching is used.

Can I run INSERT, UPDATE, or DELETE?

No. Only SELECT queries are supported. The in-memory tables are read-only to keep the tool safe and predictable for practice without unexpected side-effects.

How do I run a query?

Type your SQL in the editor and press the Run button or use Ctrl+Enter (Cmd+Enter on Mac). Results appear in a scrollable table below. Error messages are shown in red if the query is invalid.

Is my query data sent anywhere?

No. All SQL execution happens entirely in your browser using a custom in-browser SQL engine. No data is uploaded to any server.