Bird
0
0

Given a table:

hard📝 Application Q8 of 15
SQL - Database Design and Normalization
Given a table:
CREATE TABLE PurchaseDetails (OrderID INT, ItemID INT, ItemName VARCHAR(50), Quantity INT, Manufacturer VARCHAR(50), PRIMARY KEY (OrderID, ItemID));
Manufacturer depends only on ItemID. How should the table be redesigned to comply with 2NF?
ASplit into two tables: PurchaseDetails(OrderID, ItemID, Quantity) and Items(ItemID, ItemName, Manufacturer).
BAdd Manufacturer to the primary key.
CRemove Manufacturer column from the table.
DMake Manufacturer depend on OrderID instead.
Step-by-Step Solution
Solution:
  1. Step 1: Identify partial dependency

    Manufacturer depends only on ItemID, part of the composite key (OrderID, ItemID).
  2. Step 2: Normalize

    Separate Manufacturer and ItemName into a new table keyed by ItemID to remove partial dependency.
  3. Final Answer:

    Split into two tables: PurchaseDetails(OrderID, ItemID, Quantity) and Items(ItemID, ItemName, Manufacturer). -> Option A
  4. Quick Check:

    Partial dependency removed by table split [OK]
Quick Trick: Separate attributes dependent on part of key into new table [OK]
Common Mistakes:
  • Adding dependent attribute to primary key incorrectly
  • Removing columns without preserving data
  • Misunderstanding dependency directions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes