Check sibling questions
Computer Science - Class 12
Chapter 8 - Database Concepts

What is primary key?

 

Answer:

Primary key is a set of one or more attributes which can uniquely identify each tuple of a relation.

Example:

Employee_id

Employee_name

Department

101

Ravi Kumar

Sales

102

Tarun A

IT

103

Jennifer Davis

HR

104

Martin Woods

HR

105

Ron Romy

IT

 

In the Employee table, the Employee_id of all employees are different . So it can be used to uniquely identify each employee and hence, we set Employee_id as the primary key.

Additional points:

  • A relation can have only 1 primary key.
  • A primary key can consist of single or multiple columns.
  • Primary keys must contain unique values.
  • Primary keys cannot contain NULL values.

Are ads bothering you?


Transcript

What is primary key? Answer: Primary key is a set of one or more attributes which can uniquely identify each tuple of a relation. Example: Employee_id Employee_name Department 101 Ravi Kumar Sales 102 Tarun A IT 103 Jennifer Davis HR 104 Martin Woods HR 105 Ron Romy IT In the Employee table, the Employee_id of all employees are different. So it can be used to uniquely identify each employee and hence, we set Employee_id as the primary key. Additional points: A relation can have only 1 primary key. A primary key can consist of single or multiple columns. Primary keys must contain unique values. Primary keys cannot contain NULL values.

Davneet Singh's photo - Teacher, Engineer, Marketer

Made by

Davneet Singh

Davneet Singh is a graduate from Indian Institute of Technology, Kanpur. He has been teaching from the past 12 years. He provides courses for Maths and Science at Teachoo.