MCQ | SQL – Keys

SQL Keys MCQ: This section contains the Multiple-Choice Questions & Answers on SQL Keys.
Submitted by Anushree Goswami, on September 28, 2021

SQL Keys MCQs

1. A Key which uniquely identifies each row in the table is known as?

  1. Primary Key
  2. Unique Key
  3. Composite Key
  4. Foreign Key

Answer: A) Primary Key

Explanation:

A Key which uniquely identifies each row in the table is known as Primary Key.

Discuss this Question


2. A Primary Key is basically a –

  1. Row
  2. Column
  3. Table
  4. Database

Answer: B) Column

Explanation:

A Primary Key is basically a Column or Columns.

Discuss this Question


3. If multiple columns are used as Primary Key, it is known as –

  1. Unique
  2. Composite
  3. Foreign
  4. None of the above

Answer: B) Composite

Explanation:

If multiple columns are used as Primary Key, it is known as Composite Key.

Discuss this Question


4. Which of the following statement is TRUE about Primary Key?

  1. Table integrity is not enforced by the primary key.
  2. The data in a primary key is always multiple.
  3. 900 bytes is the maximum length of a primary key.
  4. Null values are allowed in primary keys.

Answer: C) 900 bytes is the maximum length of a primary key

Explanation:

we can have up to 16 columns as primary key column and the total size of the key columns should be less than or equal to 900 bytes.

Discuss this Question


5. Primary keys can be contained in a table only ____?

  1. Once
  2. Twice
  3. Thrice
  4. None of the above

Answer: A) Once

Explanation:

Primary keys can be contained in a table only once.

Discuss this Question


6. To add a Primary Key constraint after table is created, which clause is used?

  1. UPDATE
  2. ADD
  3. ALTER
  4. JOIN

Answer: C) ALTER

Explanation:

To add a Primary key constraint after table is created, ALTER clause is used.

Discuss this Question


7. In order to remove a primary key constraint, which clause is used?

  1. DELETE
  2. DROP
  3. ALTER
  4. REMOVE

Answer: B) DROP

Explanation:

In order to remove a primary key constraint, DROP clause is used.

Discuss this Question


8. In order to build a link between two tables, which key is used?

  1. Primary
  2. Foreign
  3. Composite
  4. Unique

Answer: B) Foreign

Explanation:

In order to build a link between two tables, foreign key is used.

Discuss this Question


9. Which of the following statement is FALSE?

  1. A Primary Key cannot be NULL
  2. A Foreign Key cannot be NULL
  3. A Primary Key cannot be Duplicate
  4. A Foreign Key can be Duplicate

Answer: B) A Foreign Key cannot be NULL

Explanation:

The option (B) is false, because a foreign key can be NULL or duplicate.

Discuss this Question


10. Foreign key is a field in a table that is _______ key in another table?

  1. Primary
  2. Unique
  3. Composite
  4. None of the above

Answer: A) Primary

Explanation:

Foreign key is a field in a table that is Primary Key in another table.

Discuss this Question


11. When two or more columns are combined to be used to uniquely identify each row in the table, it is known as -

  1. Primary Key
  2. Unique Key
  3. Composite Key
  4. Foreign Key

Answer: C) Composite Key

Explanation:

When two or more columns are combined to be used to uniquely identify each row in the table, it is known as Composite Key.

Discuss this Question


12. For one table, there can be ____unique key constraint(s).

  1. 1
  2. NULL
  3. Many
  4. None of the above

Answer: C) Many

Explanation:

For one table, there can be many unique key constraints.

Discuss this Question


13. All other columns other than the column which is termed as Primary Key, are known as –

  1. Unique Keys
  2. Alternate Keys
  3. Composite Keys
  4. None of the above

Answer: B) Alternate Keys

Explanation:

All other columns other than the column which is termed as Primary Key, are known as Alternate Keys.

Discuss this Question






Comments and Discussions!

Load comments ↻






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