Skip to content
Foundations · drill

Label every order

For each order, return its id and a label: 'big' when the total is over 1000, 'unknown' when there is no total at all, and 'small' otherwise. Order by id. Call the second column size.

Tables in this database · Shop
CREATE TABLE customers (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  city TEXT NOT NULL,
  signed_up DATE NOT NULL,
  newsletter BOOLEAN
)
CREATE TABLE orders (
  id INTEGER PRIMARY KEY,
  customer_id INTEGER NOT NULL,
  placed_on DATE NOT NULL,
  total NUMERIC(10,2),
  shipped BOOLEAN
)
CREATE TABLE products (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  price NUMERIC(10,2) NOT NULL,
  discontinued BOOLEAN NOT NULL
)

Your query

⌘⏎