RDBMS Questions and Answers – Integrity Constraints

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
b) unique
c) identical
d) check
View Answer

Answer: c
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
View Answer

Answer: b
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
View Answer

Answer: a
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.
advertisement
advertisement

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.
View Answer

Answer: c
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
View Answer

Answer: b
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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. Referential integrity constraints are also called as _________
a) Functional dependencies
b) Subset dependencies
c) Superset dependencies
d) Primary dependencies
View Answer

Answer: b
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
a) Assertion
b) Reason
c) Mandate
d) Verify
View Answer

Answer: a
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.
advertisement

8. State true or false: Oracle does not support complex check conditions
a) True
b) False
View Answer

Answer: a
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?
a) create check ;
b) create assertion where ;
c) create where ;
d) create assertion check ;
View Answer

Answer: d
Explanation: We use “create assertion check ;” statement to create a new assertion in a relation.
advertisement

Sanfoundry Global Education & Learning Series – RDBMS.

To practice all areas of RDBMS, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.