Computer AwarenessHardIBPS SO IT Officer

ORDERS.CustomerID is a foreign key to CUSTOMER, declared with ON DELETE CASCADE. What happens when a customer row is deleted?

  1. A. The delete is refused while any order for that customer exists
  2. B. The customer's orders are deleted automatically along with it
  3. C. The CustomerID in that customer's orders is set to NULL
  4. D. The orders are kept unchanged and point to a missing customer

Correct answer: B. The customer's orders are deleted automatically along with it

CASCADE propagates the delete to the referencing rows. Refusing the delete is the default (RESTRICT/NO ACTION) and setting NULL is ON DELETE SET NULL.

हिंदी में

ORDERS.CustomerID, CUSTOMER की फ़ॉरेन की है, जो ON DELETE CASCADE के साथ घोषित है। ग्राहक की पंक्ति हटाने पर क्या होता है?

  1. A. उस ग्राहक का कोई भी ऑर्डर रहने तक हटाना अस्वीकार कर दिया जाता है
  2. B. ग्राहक के ऑर्डर उसके साथ अपने आप हट जाते हैं
  3. C. उस ग्राहक के ऑर्डरों में CustomerID NULL कर दिया जाता है
  4. D. ऑर्डर अपरिवर्तित रहते हैं और अनुपस्थित ग्राहक की ओर संकेत करते हैं

उत्तर: B. CASCADE हटाने को संदर्भित पंक्तियों तक फैलाता है। हटाने को अस्वीकार करना डिफ़ॉल्ट (RESTRICT/NO ACTION) है और NULL करना ON DELETE SET NULL है।

More Computer Awareness questions

Exams that ask this topic