📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

Which constraint would prevent storing a negative quantity in an Orders table?

A. DEFAULT 0 on Quantity
B. UNIQUE (Quantity)
C. CHECK (Quantity >= 0) ✅
D. FOREIGN KEY (Quantity)

Correct Answer: C. CHECK (Quantity >= 0)

Explanation

  • CHECK (Quantity >= 0) rejects negative quantities.
  • DEFAULT only supplies a value when none is given and does not block negatives.