Home »
SQL »
SQL MCQs
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?
- Primary Key
- Unique Key
- Composite Key
- 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 –
- Row
- Column
- Table
- 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 –
- Unique
- Composite
- Foreign
- 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?
- Table integrity is not enforced by the primary key.
- The data in a primary key is always multiple.
- 900 bytes is the maximum length of a primary key.
- 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 ____?
- Once
- Twice
- Thrice
- 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?
- UPDATE
- ADD
- ALTER
- 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?
- DELETE
- DROP
- ALTER
- 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?
- Primary
- Foreign
- Composite
- 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?
- A Primary Key cannot be NULL
- A Foreign Key cannot be NULL
- A Primary Key cannot be Duplicate
- 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?
- Primary
- Unique
- Composite
- 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 -
- Primary Key
- Unique Key
- Composite Key
- 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
- NULL
- Many
- 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 –
- Unique Keys
- Alternate Keys
- Composite Keys
- 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