Skip to content

Grading

How your answer is graded

The same rules run on every question, in your browser, on the sample and on each hidden dataset. They are strict about what the question asks and relaxed about everything else.

Every question runs your query on the visible sample data and on at least two hidden datasets built to catch common mistakes: ties, NULLs, empty groups, duplicate rows and dates on the edge of a range. Your answer passes when it returns the right result on all of them.

We compare results, not query text. Any query that returns the right rows passes, however it is written.

The rules below are the whole grader. Each one is covered by an automated test (tests/grader.test.ts), and every question in the bank is checked against them with a reference solution, at least two other correct solutions and at least three known-wrong queries.

1. Rows are compared as a set, duplicates included

Row order does not matter unless the question asks for a sort (rule 9). Duplicates count: if the answer has a row twice, yours must have it twice. A missing row and an extra row are both listed under your result, so you can see exactly what differs.

2. The number of columns must match

If the question asks for three columns, return three. A missing or extra column fails, and the message names the columns the answer has.

3. Column names are not graded

Columns are matched by position first. If your columns come in another order, they are matched by name, and failing that by their values. A note tells you when your names or column order differ from the question, because a human interviewer will notice.

4. Numbers compare as numbers

3, 3.0 and 3.000 are equal, whether the column is an integer, a numeric or a float. Tiny float noise (a relative difference under 0.0000001%) is ignored. Integer division is not: 0 is not 0.5.

5. Rounding

When a question asks for a number of decimal places:

When a question asks for rounding on some columns only (say a share to 1 place next to money in cents), the allowance applies to those columns and the others must match exactly.

When a question does not mention rounding, no rounding allowance applies.

6. NULL matches only NULL

An empty string, 0 or the text 'NULL' is not NULL.

7. Text is exact

Case and spaces matter: Paris, paris and Paris are three different values. Labels you compute yourself (for example with CASE) must use the exact words the question gives.

8. Dates, timestamps and months

All times in the practice data are UTC.

9. Sort order, only when asked

If the question says how to sort, your rows must come in that order, checked only on the columns it names. Rows that tie on every named column may come in any order. NULLs may sort first or last. Text sorts by byte order, as Postgres does with the C collation (capital letters before lower case).

10. Empty answers

Some hidden datasets have no qualifying rows. Then the right answer is an empty result with the right columns.

11. Size limit

Results over 5,000 rows are not graded. No answer in the bank is longer than 400 rows, so a result that big means a join is multiplying rows.

Where your query runs

Queries run in PostgreSQL 19 compiled to WebAssembly, inside your browser. Nothing is sent to a server. Each query runs in a read-only transaction that is rolled back, so you cannot change the data, and one statement runs at a time. A query that runs longer than 8 seconds is stopped.