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

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.


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.


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.


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.


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.


Advertisement

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.


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.


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.


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.


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.


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.


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.


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.


ADVERTISEMENT
ADVERTISEMENT




Comments and Discussions!




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.