Question 135Asked in DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)

What is the difference between a primary key and a foreign key in a database?

  1. AA primary key is used to sort records in a table, while a foreign key is used to filter records in a table.
  2. BA primary key is a unique identifier for each record in a table, while a foreign key is used to link records in one table to records in another table.
  3. CThere is no difference between a primary key and a foreign key.
  4. DA primary key is used to link records in one table to records in another table, while a foreign key is a unique identifier for each record in a table.
Show answerHide answer

Correct answer: (B) A primary key is a unique identifier for each record in a table, while a foreign key is used to link records in one table to records in another table.

Explanation

A primary key uniquely identifies each row in its table. A foreign key refers to a primary key in another table, which links the tables.

From DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 3 (4:30 PM)

This is question 135 of DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 3 (4:30 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.