Q.An organisation wants to create a database EMP-DEPENDENT to maintain following details about its employees and their dependent.
EMPLOYEE(AadharNumber, Name, Address, Department,EmployeeID)
DEPENDENT(EmployeeID, DependentName, Relationship)
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Candidate keys are the attributes that can each uniquely identify an employee — AadharNumber and EmployeeID. To fetch a particular employee's dependents you need both relations joined on EmployeeID (primary key in EMPLOYEE, foreign key in DEPENDENT). Degree just counts attributes: EMPLOYEE has 5, DEPENDENT has 3.
The schema:
EMPLOYEE(AadharNumber, Name, Address, Department, EmployeeID)
DEPENDENT(EmployeeID, DependentName, Relationship)
a) Candidate keys of EMPLOYEE
A candidate key is a minimal attribute (set) whose value is unique for every tuple. Test each attribute:
- AadharNumber — Aadhaar is unique per person by design → candidate key. ✓
- EmployeeID — issued uniquely to each employee by the organisation → candidate key. ✓
- Name, Address, Department — two employees can share any of these → not keys. ✗
So the candidate keys are AadharNumber and EmployeeID; one of them (typically EmployeeID) becomes the primary key and the other remains an alternate key.
b) Retrieving the dependents of a particular employee
The details needed live in both tables: the employee is identified in EMPLOYEE, and the dependent rows sit in DEPENDENT. The connecting key is EmployeeID — primary key of EMPLOYEE, and the foreign key in DEPENDENT that says whose dependent each tuple is.
SELECT E.Name, D.DependentName, D.Relationship
FROM EMPLOYEE E
JOIN DEPENDENT D ON D.EmployeeID = E.EmployeeID -- FK in DEPENDENT matched to PK in EMPLOYEE
WHERE E.EmployeeID = 'E101';
Example result for employee E101:
| Name | DependentName | Relationship |
|---|---|---|
| Meera | Aarav | Son |
| Meera | Kavya | Daughter |
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.