-
Notifications
You must be signed in to change notification settings - Fork 227
Description
For the "CREATE TABLE Order_Items (
order_item_id INT PRIMARY KEY,
order_id INT,
product_id INT,
quantity INT,
unit_price DECIMAL(10, 2),
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
);"
The product table have only 16 id's, which means that when inserting the data into the Order_Items table beyond 16 entries, it will cause an issue.
This is because the FOREIGN KEY constraint in the Order_Items table ensures that every product_id referenced in Order_Items must already exist in the Products table. If the Products table only has entries up to product_id 16, any INSERT statement in Order_Items that references a product_id higher than 16 will violate the foreign key constraint and result in an error.