Which statement adds a constraint that ensures the CUSTOMER_NAME column of the CUSTOMERS table
holds a value?
A.
ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name IS NOT NULL;
B.
ALTER TABLE customers MODIFY CONSTRAINT cust_name_nn CHECK customer_name IS NOT NULL;
C.
ALTER TABLE customers MODIFY customer_name CONSTRAINT cust_name_nn NOT NULL;
D.
ALTER TABLE customers MODIFY customer_name CONSTRAINT cust_name_nn IS NOT NULL;
E.
ALTER TABLE customers MODIFY name CONSTRAINT cust_name_nn NOT NULL;
F.
ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name NOT NULL;
SQL> conn tanawat/welcome1
Connected.
SQL> desc employees
Name Null? Type
—————————————– ——– —————————-
EMPLOYEE_ID NUMBER
LOGIN_ID NUMBER
EMPLOYEE_NAME VARCHAR2(100)
HIRE_DATE DATE
SQL>
SQL> alter table employees modify employee_name constraint emp_name_nn NOT NULL ;
Table altered.
SQL> desc employees
Name Null? Type
—————————————– ——– —————————-
EMPLOYEE_ID NUMBER
LOGIN_ID NUMBER
EMPLOYEE_NAME NOT NULL VARCHAR2(100)
HIRE_DATE DATE
SQL>
A is wrong just because it’s missing parenthesis in the expression “customer_name IS NOT NULL”.