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

What are keys? Name all the keys used in DBMS.

 

Answer:

  • A key is an attribute or set of attributes that help to identify records in a table.
  • To retrieve data from more than one table, we join the tables using keys .
  • It also controls and maintains integrity of information stored in the database.
  • The various types of keys are:
  1. Primary key
  2. Candidate key
  3. Alternate key
  4. Foreign key

Example:

Employee_id

Employee_name

Dept_id

Emp_Email

101

Ravi Kumar

1011

[email protected]

102

Tarun A

1012

[email protected]

103

Jennifer Davis

1013

[email protected]

104

Martin Woods

1013

[email protected]

105

Ron Romy

1012

[email protected]

 

Dept_id

Dept_name

1011

Sales

1021

IT

1031

HR

 

In table Employee,

  • Primary key - Employee_id
  • Candidate keys - Employee_id,Emp_Email
  • Alternate key - Emp_Email
  • Foreign key - Dept_id

In table Department,

  • Primary key - Dept_id

Get Real time Doubt solving from 8pm to 12 am!


Transcript

What are keys? Name all the keys used in DBMS. Answer: A key is an attribute or set of attributes that help to identify records in a table. To retrieve data from more than one table, we join the tables using keys. It also controls and maintains integrity of information stored in the database. The various types of keys are: Primary key Candidate key Alternate key Foreign key Example: Employee_id Employee_name Dept_id Emp_Email 101 Ravi Kumar 1011 [email protected] 102 Tarun A 1012 [email protected] 103 Jennifer Davis 1013 [email protected] 104 Martin Woods 1013 [email protected] 105 Ron Romy 1012 [email protected] Dept_id Dept_name 1011 Sales 1021 IT 1031 HR In table Employee, Primary key - Employee_id Candidate keys - Employee_id,Emp_Email Alternate key - Emp_Email Foreign key - Dept_id In table Department, Primary key - Dept_id

Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 12 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.