Loading

Quipoin Menu

Learn • Practice • Grow

sql / Constraints
mcq
Direction: Choose the correct option

Q1.

ALTER TABLE employees ADD CONSTRAINT chk_salary CHECK (salary > 0);
What is 'chk_salary'?
A. Index name
B. Column name
C. Table name
D. Constraint name
Direction: Choose the correct option

Q2.

Can a table have multiple CHECK constraints?
A. No
B. Depends on database
C. Yes
D. Only one
Direction: Choose the correct option

Q3.

What happens when you try to insert NULL into a NOT NULL column?
A. Error occurs
B. Default used
C. NULL inserted
D. Insert succeeds
Direction: Choose the correct option

Q4.

How do you drop a constraint?
A. REMOVE CONSTRAINT
B. DROP CONSTRAINT ... FROM
C. DELETE CONSTRAINT
D. ALTER TABLE ... DROP CONSTRAINT
Direction: Choose the correct option

Q5.

CREATE TABLE users (
email VARCHAR(100) UNIQUE
);
What happens with duplicate emails?
A. Both inserted
B. Warning only
C. Second insert overwrites first
D. Second insert fails