0000
Before seeing the chapter please follow the previous chapter: Find Prime and Non-Prime Attribute, Find Super and Candidate Key from Attribute Closer
Q: Gate 2005
.png)
What are Candidate Keys?
1. AE, CE
2. AE, BE, DE
3. AEH, BEH, DEH
4. AEH, BEH, BCH
Solution:
AE is common in every option
So, we can calculate the closure of AE
.png)
.png)
.png)
(AEH) is Super Key (SK) and Candidate Key (CK) also
CK = {AEH}, PA = {A, E, H}
We can find A from D → A
.png)
So, DEH is SK and CK
CK = {AEH, DEH}, PA = {A, E, H, D}
Looking for PA at FDs find BC → D
.png)
But it is a SK but not CK because it is not minimal reason is from E we can derive
C (E → C).
So, what is the minimum?
.png)
.png)
So, option 3 is correct.
Question:
.png)
Calculate the number of Candidate Key and Prime Attribute.
Solution:
.png)
but from FDs it is clear that from any FD we can’t find E. we can do one thing.
AE = ABCDE [Augmented both side by E]
.png)
.png)
So, AE is SK and CK also
.png)
CK = {AE}, PA = {A, E}
Looking for A and E as Prime Attribute (PA) at any FDs of the left-hand side,
.png)
.png)
So, ED is SK and CK
CK = {EA, ED}, PA = {A, E, D}
.png)
.png)
So, EC is SK and CK
CK = {EA, ED, EC}, PA = {A, E, D, C}
Again,
.png)
.png)
So, EB is SK and CK
CK = {EA, ED, EC, EB}, PA = {A, E, D, C, B}
.png)
So, CK = {AE, DE, CE, BE}, PA = {A, E, D, C, B}, NPA = ɸ = { }
Question:
Given Relation R (ABCD) and FDs {AB → C, C → D, CE → F, F → G}.
Find out Candidate Key.
Solution:
Important:
One thing is very clear from FDs that CE → F, F → G but E, F, G attributes are not present in the given relation R (ABCD). So, we can delete it.
.png)
.png)
Candidate Key (CK) = {AB}, Primary Key (PA) = {A, B}
.png)
So, we can calculate valid FDs by using the transitive rule.
.png)
.png)
.png)
.png)
.png)
.png)
.png)
So, if given FDs are invalid, so we derive valid FDs from invalid ones if possible.