What is the purpose of the SQL 'CONSTRAINT' keyword? MCQ with Answer and Explanation

What is the purpose of the SQL 'CONSTRAINT' keyword?
A. To create indexes
B. To create views
C. To join tables
D. To define rules for data integrity
Answer: Option D
Solution (By JKExamLibrary)
Constraints are used to enforce rules on data, such as NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, and CHECK.

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

Discuss this Question (0)

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

Practice More Database Management System (DBMS) Questions

Question #1 Report Error
Which of the following is a valid constraint in SQL?
A. PRIMARY KEY
B. CHECK
C. All of the above
D. FOREIGN KEY

Correct Answer: Option C


Explanation:
CHECK, PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL are all constraints in SQL.

This question belongs to: Computer Database Management System (DBMS)
Question #2 Report Error
What is the concept of data independence?
A. The ability to store data in different formats
B. The ability to access data from multiple sources
C. The ability to change the database schema without affecting the application programs
D. The ability to move data between tables

Correct Answer: Option C


Explanation:
Data independence is the capacity to change the database schema at one level without affecting the next higher level, minimizing impact on applications.

This question belongs to: Computer Database Management System (DBMS)
Question #3 Report Error
What is the difference between DELETE and TRUNCATE commands?
A. TRUNCATE can have WHERE; DELETE cannot
B. DELETE can be rolled back; TRUNCATE cannot (in most DBMS)
C. DELETE removes all rows; TRUNCATE removes structure
D. No difference

Correct Answer: Option B


Explanation:
DELETE is a DML command that can be rolled back and can use WHERE; TRUNCATE is a DDL command that removes all rows and cannot be rolled back (in some DBMS) and resets auto-increment counters.

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