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

1. By constraining a SQL statement, we limit the ____ according to certain conditions or restrictions.

  1. Row
  2. Column
  3. Table
  4. 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?

  1. Column Level
  2. Table Level
  3. Both A and B
  4. None of the above

Answer: C) Both A and B

Explanation:

SQL Constraints can be categorized in two types:

  1. Column Level Constraint
  2. Table Level Constraint

Discuss this Question


3. What is the difference between Column Level and Table Level Constraints?

  1. Constraints are applied to a single row using Column Level Constraints whereas Multiple rows can be constrained using a Table Level Constraint.
  2. Constraints are applied to multiple rows using Column Level Constraints whereas a single row can be constrained using a Table Level Constraint.
  3. Constraints are applied to a single column using Column Level Constraints whereas Multiple columns can be constrained using a Table Level Constraint.
  4. 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?

  1. One uppercase character must be included in the password.
  2. An eight-character minimum password is required.
  3. At least one symbol must appear in the password.
  4. All of the above

Answer: D) All of the above

Explanation:

The constraints that are needed to be put in the Password system are:

  1. One uppercase character must be included in the password.
  2. An eight-character minimum password is required.
  3. At least one symbol must appear in the password.

Discuss this Question


5. Select the correct constraint in SQL?

  1. NOT NULL
  2. CHECK
  3. DEFAULT
  4. All of the above

Answer: D) All of the above

Explanation:

The constraints available in SQL are:

  1. CHECK
  2. CREATE INDEX
  3. DEFAULT
  4. FOREIGN KEY
  5. NOT NULL
  6. PRIMARY KEY
  7. UNIQUE

Discuss this Question


6. What is TRUE about NOT NULL Constraint?

  1. In columns that are subject to the NOT NULL constraint, duplicate values are not allowed.
  2. When a table's column is declared as NOT NULL, no record in the table can have an empty value for that column.
  3. By applying the NOT NULL constraint, we will always ensure that the column contains a unique value and won't allow nulls.
  4. 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 –

  1. ZERO
  2. -1
  3. 1
  4. Empty

Answer: D) Empty

Explanation:

NULL means empty, not even zero.

Discuss this Question


8. Which of the following is TRUE about UNIQUE constraint?

  1. In columns that are subject to the UNIQUE constraint, duplicate values are not allowed.
  2. Unique values will always be present in the column containing the unique constraint.
  3. A single table can have more than one unique constraint, since it can be applied to more than one column.
  4. All of the above

Answer: D) All of the above

Explanation:

In case of UNIQUE constraint:

  1. In columns that are subject to the UNIQUE constraint, duplicate values are not allowed.
  2. Unique values will always be present in the column containing the unique constraint.
  3. 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.

  1. Change
  2. Delete
  3. Modify
  4. 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.

  1. NOT NULL , CHECK
  2. NOT NULL , DEFAULT
  3. NOT NULL , FOREIGN KEY
  4. 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.

  1. Referential Integrity
  2. Domain Integrity
  3. User-defined Integrity
  4. 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?

  1. 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.
  2. 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.
  3. An index can be created on the table using the DEFAULT constraint.
  4. 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





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.