Past Year - 2 Mark Questions

Computer Science - Class 12
Chapter 8 - Database Concepts

## Differentiate between the primary key and alternate key of a table with the help of an example.

• Primary key refers to a set of one or more attributes which can uniquely identify tuples in a relation.
• Alternate key refers to any candidate key which is not selected as the primary key.

Example:

 Employee_id Employee_name Department Emp_Email 101 Ravi Kumar Sales 102 Tarun A IT 103 Jennifer Davis HR 104 Martin Woods HR 105 Ron Romy IT

In table employee, the candidate keys are Employee_id and Emp_Email since we can uniquely identify an employee with either of the two.

If we select Employee_id as the primary key, then Emp_Email becomes an alternate key.

Learn in your speed, with individual attention - Teachoo Maths 1-on-1 Class

### Transcript

Differentiate between the primary key and alternate key of a table with the help of an example. Answer: Primary key refers to a set of one or more attributes which can uniquely identify tuples in a relation. Alternate key refers to any candidate key which is not selected as the primary key. Example: Employee_id Employee_name Department Emp_Email 101 Ravi Kumar Sales [email protected] 102 Tarun A IT [email protected] 103 Jennifer Davis HR [email protected] 104 Martin Woods HR [email protected] 105 Ron Romy IT [email protected] In table employee, the candidate keys are Employee_id and Emp_Email since we can uniquely identify an employee with either of the two. If we select Employee_id as the primary key, then Emp_Email becomes an alternate key.