runtime
23 / 88

task CREATE / ALTER · easy

Create a wishlist table

Create a table wishlist with shopper_id INTEGER NOT NULL, item_id INTEGER NOT NULL and added_on TEXT, where (shopper_id, item_id) is the primary key. Insert (1, 12, '2025-03-01') and (2, 4, '2025-03-02'), then return all wishlist rows ordered by shopper_id.

what to return

Columns
shopper_iditem_idadded_on in this order
Rows
2 rows · in the order asked
Watch for
The same shopper can't list the same item twice.
Neither id may be NULL.
Skill
Define a table with a composite primary key and NOT NULL columns. Refresher: Constraints protect the data contract →

expected result

Your query should return exactly these columns and values. Run it and compare.

expected result2 rows · in this order
shopper_iditem_idadded_on
1122025-03-01
242025-03-02

all 2 rows

data you can query

Sample rows from each table. Each column shows its type underneath; → marks a link to another table.

shoppers5 columns · 17 rows
idinteger · keynametextemailtextregiontextsignup_datetext
1Ana Ruizana@harbor.testWest2025-01-03
2Ben Okaforben@harbor.testEast2025-01-05
3Chloe Parkchloe@harbor.testWest2025-01-09
4Dmitri Volkovdmitri@harbor.testNorth2025-01-14
5Esi MensahNULLSouth2025-01-20

showing 5 of 17 rows

catalog_items4 columns · 13 rows
idinteger · keynametextcategorytextpricereal
1Desk LampLighting39
2Floor lampLighting89
3String LightsLighting19.5
4Chef KnifeKitchen59
5Cast Iron PanKitchen45

showing 5 of 13 rows

solution.sql
 

Hints and the answer are always available. Using them counts the question as solved with help.