Filter a closed amount range

Difficulty: Easy

SQL

Return ids with amount_cents from 500 through 1200 inclusive, ordered by id.

Return columns id. Use the specified ordering; ties must be resolved as described.

Schema and sample data

CREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT, city TEXT, email TEXT);
CREATE TABLE orders (id INTEGER PRIMARY KEY, customer_id INTEGER, amount_cents INTEGER, status TEXT, ordered_on TEXT);
CREATE TABLE returns (id INTEGER PRIMARY KEY, order_id INTEGER, amount_cents INTEGER);

orders

idcustomer_idamount_centsstatusordered_on
111200paid2026-01-02
21800refunded2026-01-03
321200paid2026-02-01
4990pending2026-02-02

returns

idorder_idamount_cents
11200
21100
32800

customers

idnamecityemail
1AdaAustina@example.test
2BoDallasNULL
3CyAustina@example.test

Each test uses a fresh database. Column names must match the requested aliases.

Constraints

Use one SQLite SELECT query, optionally with CTEs. No writes, uploads, network, or extension loading. Data is synthetic. Integers are cents; do not use floating-point money. Each test has at most 1,000 rows per table. Medium exercises combine query stages; no database index is assumed.

Review lesson: Filtering with precise predicates
SQL

Ready when you are

Write your solution, then run it against the practice tests.

Press Esc, then Tab to leave the editor. Code runs in an isolated browser workspace. Tests support learning, not verified grading.

Reset your code?

This replaces your current code with the starter and stops any running tests.