QuestionQ79

VerifiedCreating and Managing Tables

You want to create an ORD_DETAIL table to store the details of a placed order, with these business requirements:

  1. The order ID must be unique and cannot contain null values.
  2. The order date cannot contain null values, and its default must be the current date.
  3. The order amount must not be less than 50.
  4. The order status must be either shipped or not shipped.
  5. The order payment mode must be cheque, credit card, or cash on delivery (COD).

Which DDL statement is valid for creating the ORD_DETAIL table?

Explanation

A primary key enforces both uniqueness and non-null values for the order ID. The condition ord_amount >= 50 permits 50 and all higher amounts, which matches an amount that must not be less than 50. DEFAULT SYSDATE NOT NULL supplies the current date when no date is provided while prohibiting nulls, and the IN check constraints restrict status and payment mode to their allowed values.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!