This set of RDBMS Multiple Choice Questions & Answers (MCQs) focuses on “Integrity Constraints”.
1. Which of the following is not an integrity constraint?
a) not null
Explanation: Identical is not an allowed integrity constraint in SQL. Not null prevents null values and unique only allows unique values to be entered. Check checks for a given condition.
2. What is the function of the not null constraint?
a) It prevents illegal data from being entered into the database
b) It ensures that data is entered into the database
c) It ensures that the data entered is unique
d) None of the mentioned
Explanation: The not null constraint ensures that data is entered into the database. It displays an error message whenever a data field mentioned is left empty.
3. What is the function of the unique constraint?
a) It ensures that no two values under an attribute are identical
b) It ensures that all the attributes are perfectly unique in their data type
c) It ensures that all the relations in the database have a unique set of attributes
d) It does not have any function in SQL
Explanation: The purpose of the unique clause is to ensure that no two values under the same attribute are identical. Primary keys are unique by default.
4. What is the functions of on delete cascade?
a) It is used to delete a tuple in a table
b) It is used to specify the precise attribute that needs to be deleted in a single relation.
c) It is used to preserve referential integrity in a relation
d) It is used to execute sub-queries in the from clause.
Explanation: It is used to preserve referential integrity in the relation. When an attribute of a relation is the foreign key in another relation, deleting it causes referential integrity problems. The on delete cascade solves this problem by forcing us to delete the foreign key first.
5. What does the following condition do?
check( name in( ‘Ryan’, ‘Cristiano’, ‘Leo’))
a) The condition checks whether the name attribute includes the three mentioned names
b) The condition allows the name attribute to possess only the three mentioned names
c) The condition checks whether the given names are sub-strings in at least one of the values
d) None of the mentioned
Explanation: The check clause allows the attribute to take only those values that are explicitly specified by the user inside the parentheses after the in key word.
6. Referential integrity constraints are also called as _________
a) Functional dependencies
b) Subset dependencies
c) Superset dependencies
d) Primary dependencies
Explanation: Referential integrity constraints are also called as subset dependencies. It is called so because the set of foreign key values in r1 of r2 must be a subset of the set of primary key values in r2.
7. ________ is a predicate that we expect the database to always satisfy
Explanation: An assertion is a predicate that we expect the database to always satisfy. Domain constraints and referential integrity constraints are special forms of assertions.
8. State true or false: Oracle does not support complex check conditions
Explanation: Most of the widely used database management systems including oracle currently do not support complex check conditions.
9. What statement is used to define a new assertion in SQL? Sanfoundry Global Education & Learning Series – RDBMS. To practice all areas of RDBMS, here is complete set of 1000+ Multiple Choice Questions and Answers.
b) create assertion
d) create assertion
Explanation: We use “create assertion
Sanfoundry Global Education & Learning Series – RDBMS.
To practice all areas of RDBMS, here is complete set of 1000+ Multiple Choice Questions and Answers.