task Constraints · hard
Enforce delivery-slot rules
Create delivery_slots with slot_id INTEGER PRIMARY KEY, warehouse_id INTEGER NOT NULL referencing warehouses(warehouse_id), slot_date TEXT NOT NULL that must be a valid YYYY-MM-DD date, capacity INTEGER NOT NULL between 1 and 500, and at most one slot per warehouse and date. Insert (1, 1, '2025-05-01', 120) and (2, 1, '2025-05-02', 80). Return slot_id, warehouse_id, slot_date and capacity.
what to return
- Columns
slot_idwarehouse_idslot_datecapacityin this order- Rows
- 2 rows · any order
- Skill
- Encode business rules as constraints. Refresher: Constraints protect the data contract →
expected result
Your query should return exactly these columns and values. Run it and compare.
| slot_id | warehouse_id | slot_date | capacity |
|---|---|---|---|
| 1 | 1 | 2025-05-01 | 120 |
| 2 | 1 | 2025-05-02 | 80 |
all 2 rows
data you can query
Logistics dataset: the first 6 rows of each table. Under each column name: the kind of value it holds, and which table it links to. Your queries run on all rows.
warehouses6 columns · 38 rows
| warehouse_idnumber · unique id | warehouse_codetext | facility_typetext | citytext | statetext | opened_atdate |
|---|---|---|---|---|---|
| 1 | FOH1 | fulfillment | Columbus | OH | 2017-04-19 |
| 2 | FTX2 | fulfillment | Dallas | TX | 2017-03-17 |
| 3 | FCA3 | fulfillment | Sacramento | CA | 2016-02-04 |
| 4 | FNJ4 | fulfillment | Newark | NJ | 2018-11-23 |
| 5 | FGA5 | fulfillment | Atlanta | GA | 2019-07-04 |
| 6 | FIL6 | fulfillment | Chicago | IL | 2016-03-21 |
- warehouse_idnumber · unique id
- 1
- warehouse_codetext
- FOH1
- facility_typetext
- fulfillment
- citytext
- Columbus
- statetext
- OH
- opened_atdate
- 2017-04-19
- warehouse_idnumber · unique id
- 2
- warehouse_codetext
- FTX2
- facility_typetext
- fulfillment
- citytext
- Dallas
- statetext
- TX
- opened_atdate
- 2017-03-17
- warehouse_idnumber · unique id
- 3
- warehouse_codetext
- FCA3
- facility_typetext
- fulfillment
- citytext
- Sacramento
- statetext
- CA
- opened_atdate
- 2016-02-04
- warehouse_idnumber · unique id
- 4
- warehouse_codetext
- FNJ4
- facility_typetext
- fulfillment
- citytext
- Newark
- statetext
- NJ
- opened_atdate
- 2018-11-23
- warehouse_idnumber · unique id
- 5
- warehouse_codetext
- FGA5
- facility_typetext
- fulfillment
- citytext
- Atlanta
- statetext
- GA
- opened_atdate
- 2019-07-04
- warehouse_idnumber · unique id
- 6
- warehouse_codetext
- FIL6
- facility_typetext
- fulfillment
- citytext
- Chicago
- statetext
- IL
- opened_atdate
- 2016-03-21
first 6 of 38 rows · your queries use all of them
Hints and the answer are always available. Using them counts the question as solved with help.