Which of the following is a valid SQL constraint that ensures a column's values are all distinct? MCQ with Answer and Explanation

Which of the following is a valid SQL constraint that ensures a column's values are all distinct?
A. Both A and B
B. DISTINCT
C. UNIQUE
D. PRIMARY KEY
Answer: Option A
Solution (By JKSSB Mock Tests)
Both UNIQUE and PRIMARY KEY enforce uniqueness. PRIMARY KEY also implies NOT NULL.

Discuss this Question (0)

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

Practice More Database Management System (DBMS) Questions

Question #1
Which operator is used in SQL to compare a value to a set of values returned by a subquery?
A. IN
B. EXISTS
C. BETWEEN
D. LIKE

Correct Answer: Option A


Explanation:
IN checks if a value matches any value in a list or subquery result set.

This question belongs to: Computer Database Management System (DBMS)
Question #2
What is the purpose of the SQL 'WITH' clause (Common Table Expression)?
A. To delete data
B. To define a temporary result set that can be referenced within a query
C. To update data
D. To create a view

Correct Answer: Option B


Explanation:
A Common Table Expression (CTE) provides a temporary named result set that can be used within a SELECT, INSERT, UPDATE, or DELETE statement.

This question belongs to: Computer Database Management System (DBMS)
Question #3
Which condition-tester returns TRUE if a subquery returns one or more records, and FALSE if the subquery returns no rows?
A. IN
B. EXISTS
C. ALL
D. ANY

Correct Answer: Option B


Explanation:
The EXISTS operator is used to test for the presence of any records in a subquery, returning TRUE as soon as a single matching row is encountered.

This question belongs to: Computer Database Management System (DBMS)