Home »
SQL »
SQL MCQs
MCQ | SQL – Constraints Clause
SQL Constraints MCQ: This section contains the Multiple-Choice Questions & Answers on SQL Constraints.
Submitted by Anushree Goswami, on October 28, 2021
SQL Constraints Clause MCQs
1. By constraining a SQL statement, we limit the ____ according to certain conditions or restrictions.
- Row
- Column
- Table
- Database
Answer: D) Database
Explanation:
By constraining a SQL statement we limit the database according to certain conditions or restrictions.
Discuss this Question
2. Which of the following is/are type of SQL Constraint?
- Column Level
- Table Level
- Both A and B
- None of the above
Answer: C) Both A and B
Explanation:
SQL Constraints can be categorized in two types:
- Column Level Constraint
- Table Level Constraint
Discuss this Question
3. What is the difference between Column Level and Table Level Constraints?
- Constraints are applied to a single row using Column Level Constraints whereas Multiple rows can be constrained using a Table Level Constraint.
- Constraints are applied to multiple rows using Column Level Constraints whereas a single row can be constrained using a Table Level Constraint.
- Constraints are applied to a single column using Column Level Constraints whereas Multiple columns can be constrained using a Table Level Constraint.
- Constraints are applied to multiple columns using Column Level Constraints whereas only a single column can be constrained using a Table Level Constraint.
Answer: C) Constraints are applied to a single column using Column Level Constraints whereas Multiple columns can be constrained using a Table Level Constraint
Explanation:
Constraints are applied to a single column using Column Level Constraints whereas Multiple columns can be constrained using a Table Level Constraint.
Discuss this Question
4. Which of the following constraints are TRUE to be put in Password system?
- One uppercase character must be included in the password.
- An eight-character minimum password is required.
- At least one symbol must appear in the password.
- All of the above
Answer: D) All of the above
Explanation:
The constraints that are needed to be put in the Password system are:
- One uppercase character must be included in the password.
- An eight-character minimum password is required.
- At least one symbol must appear in the password.
Discuss this Question
5. Select the correct constraint in SQL?
- NOT NULL
- CHECK
- DEFAULT
- All of the above
Answer: D) All of the above
Explanation:
The constraints available in SQL are:
- CHECK
- CREATE INDEX
- DEFAULT
- FOREIGN KEY
- NOT NULL
- PRIMARY KEY
- UNIQUE
Discuss this Question
6. What is TRUE about NOT NULL Constraint?
- In columns that are subject to the NOT NULL constraint, duplicate values are not allowed.
- When a table's column is declared as NOT NULL, no record in the table can have an empty value for that column.
- By applying the NOT NULL constraint, we will always ensure that the column contains a unique value and won't allow nulls.
- The value will first be checked for certain conditions before inserting it into the column when a NOT NULL constraint applies to a column in the table.
Answer: B) When a table's column is declared as NOT NULL, no record in the table can have an empty value for that column
Explanation:
When a table's column is declared as NOT NULL, no record in the table can have an empty value for that column.
Discuss this Question
7. NULL means –
- ZERO
- -1
- 1
- Empty
Answer: D) Empty
Explanation:
NULL means empty, not even zero.
Discuss this Question
8. Which of the following is TRUE about UNIQUE constraint?
- In columns that are subject to the UNIQUE constraint, duplicate values are not allowed.
- Unique values will always be present in the column containing the unique constraint.
- A single table can have more than one unique constraint, since it can be applied to more than one column.
- All of the above
Answer: D) All of the above
Explanation:
In case of UNIQUE constraint:
- In columns that are subject to the UNIQUE constraint, duplicate values are not allowed.
- Unique values will always be present in the column containing the unique constraint.
- A single table can have more than one unique constraint, since it can be applied to more than one column.
Discuss this Question
9. You can also ____ the existing tables by using the UNIQUE constraint.
- Change
- Delete
- Modify
- Drop
Answer: C) Modify
Explanation:
You can also modify the existing tables by using the UNIQUE constraint.
Discuss this Question
10. ____ and ____constraints form the core of the PRIMARY KEY constraint.
- NOT NULL , CHECK
- NOT NULL , DEFAULT
- NOT NULL , FOREIGN KEY
- NOT NULL , UNIQUE
Answer: D) NOT NULL , UNIQUE
Explanation:
NOT NULL and UNIQUE constraints form the core of the PRIMARY KEY constraint.
Discuss this Question
11. ____ integrity is achieved by using a foreign key.
- Referential Integrity
- Domain Integrity
- User-defined Integrity
- Entity Integrity
Answer: A) Referential Integrity
Explanation:
Referential integrity is achieved by using a foreign key.
Discuss this Question
12. What is TRUE about DEFAULT constraint?
- The value will first be checked for certain conditions before inserting it into the column when a DEFAULT constraint applies to a column in the table.
- In the event of a DEFAULT constraint being applied to a table's column without a user specifying the value to be inserted when that constraint was applied, the default value that was specified when the constraint was applied will be put into that column.
- An index can be created on the table using the DEFAULT constraint.
- None of the above
Answer: B) In the event of a DEFAULT constraint being applied to a table's column without a user specifying the value to be inserted when that constraint was applied, the default value that was specified when the constraint was applied will be put into that column
Explanation:
In the event of a default constraint is applied to a table's column without a user specifying the value to be inserted when that constraint was applied, the default value that was specified when the constraint was applied will be put into that column.
Discuss this Question