Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Foreign keys
Multicolumn foreign keys
Updates and deletes
Revision
25. Revision - #2

Instruction

Nice! Let's tackle another problem.

Exercise

Based on the ERD below, create the table purchase_position.

Purchase tables

Stuck? Here's a hint!

Type:

CREATE TABLE purchase_position (
  purchase_id int  NOT NULL,
  item_id int  NOT NULL,
  seq int  NOT NULL,
  PRIMARY KEY (purchase_id, item_id, seq),
  FOREIGN KEY (purchase_id) REFERENCES purchase(id),
  FOREIGN KEY (item_id) REFERENCES item(id)
);