# Prime and Non Prime Attributes in DBMS with Example

## Prime and Non Prime Attributes in DBMS with Example –

• Prime Attributes – Attribute set that belongs to any candidate key are called Prime Attributes.
(union of all the candidate key attribute)
{CK1 ∪ CK2 ∪ CK3 ∪ ……}
If Prime attribute determined by other attribute set, then more than one candidate key is possible. For example,
If A is Candidate Key, and X→A, then, X is also Candidate Key .
• Non Prime Attribute – Attribute set does not belongs to any candidate key are called Non Prime Attributes.

#### Some Questions Based on Prime Attributes and Non Prime Attributes –

```Question 1 :
Given a relation R(ABCDEF) having FDs
{AB→C, C→D, D→E, F→B, E→F}
Identify the prime attributes and non prime attributes.```
```Solution :
(AB)+ : {ABCDEF} ⇒ Super Key
(A)+  : {A}      ⇒ Not Super Key
(B)+  : {B}      ⇒ Not Super Key
Prime Attributes  : {A,B}
(AB) → Candidate Key
↓    (as F → B)
(AF)+ : {AFBCDE}
(A)+  : {A}      ⇒ Not Super key
(F)+  :  {FB}    ⇒ Not Super Key
(AF) → Candidate Key
↓
(AE)+ : {AEFBCD}
(A)+  : {A}      ⇒ Not Super key
(E)+  : {EFB}    ⇒ Not Super key
(AE) → Candidate Key
↓
(A)+  : {A}      ⇒ Not Super key
(D)+  : {DEFB}   ⇒ Not Super key
↓
(AC)+ : {ACDEFB}
(A)+  : {A}      ⇒ Not Super Key
(C)+  : {DCEFB}  ⇒ Not Super Key
⇒ Candidate Keys {AB, AF, AE, AD, AC}
⇒ Prime Attributes {A,B,C,D,E,F}
⇒ Non Prime Attributes {} ```
```Question 2:
Given a relation R(ABCDEF) having FDs
{AB → C, C → DE, E → F, C → B}
Identify the prime attributes and non prime attributes.
```
```Solution :
(AB)+  : {A B C D E F}
(A)+   : {A}
(B)+   : {B}
(AB)  ⇒ (AC), (AC)+ : {ABCDEF}
(C)+   : {DECBF}
⇒ Candidate Keys {AB,  AC}
⇒ Prime Attributes {A,B,C}
⇒ Non Prime Attributes {D,E,F}
```
```Question 3:
Given a relation R(ABCDEFGHIJ) having FDs
{AB → C, A → DE, B → F, F → GH, D → IJ}
Identify the prime attributes and non prime attributes.
```
```Solution :
(AB)+ : {ABCDEFGHIJ}
(A)+  : {DEIJA}
(B)+  : {FGHB}
⇒ Candidate Keys {AB}
⇒ Prime Attributes {A,B}
⇒ Non Prime Attributes {C,D,E,F,G,H,I,J}```
```Question 4:
Given a relation R(ABDLPT) having FDs
{B → PT, A → D, T → L}
Identify the prime attributes and non prime attributes.
```
```Solution :
(AB)+ : {ABPTDL}
(A)+  : {DA}
(B)+  : {BPTL}
⇒ Candidate Keys {AB}
⇒ Prime Attributes {A,B}
⇒ Non Prime Attributes {D,L,P,T}```
```Question 5:
Given a relation R(ABCDEFGH) having FDs
{E → G, AB → C, AC → B, AD → E,B → D, BC → A}
Identify the prime attributes and non prime attributes.
```
```Solution :
(ABFH)+ : {ABCDEFGH}
(A)+    : {A}
(B)+    : {BD}
(F)+    : {F}
(H)+    : {H}
(AB)    : {ABCDEG}
(AF)    : {AF}
(AH)    : {AH}
(BF)    : {BFD}
(BH)    : {BHD}
(FH)    : {FH}
(ABF)   : {ABFCDEG}
(ABH)   : {ABHCDEG}
(AFH)   : {AFH}
(BFH)   : {BDFH}
None of the proper sets of {ABFH} will determine all the attributes.
So {ABFH} ⇒ minimal super key or candidate key

(A  B  FH)
↓
(A (AC) FH) ⇒ (ACFH)

( A  BFH)
↓
((BC) BFH) ⇒ (BCFH)
⇒ Candidate Keys {ABFH, ACFH, BCFH}
⇒ Prime Attributes {A,B,C,F,H}
⇒ Non Prime Attributes {D,E,G}```
```Question 6 :
Given a relation R(ABCDE) having FDs
{A → BC, CD → E, B → D, E → A}
Identify the prime attributes and non prime attributes.```
```Solution :
(A)+  : {ABCDE}  ⇒ (Candidate Key)
(E)+  : {ABCDE}  ⇒ (Candidate Key)
⇒ Candidate Keys {A,E}
⇒ Prime Attributes {A,E}
⇒ Non Prime Attributes {B,C,D}```
```Question 7 :
Consider a relation scheme R(ABCDEH) on which the following Functional Dependencies hold:
{A → B, BC → D, E → C, D → A}.
What are the candidate keys of R and identify the prime attributes and non prime attributes.```
```Solution :
(BEH)+ : {BEHCDA} ⇒ Super Key
(B)+    : {B}
(E)+    : {EC}
(H)+    : {H}
(BE)+   : {BECDA}
(BH)+   : {BHD}
(EH)+   : {EHC}

None of the proper sets of {BEH} will determine all the attributes.
So, {BEH} ⇒ minimal super key or candidate key.

(B EH)
↑
(A EH)
↑
(D EH)
⇒ Candidate Keys {BEH, AEH, DEH}
⇒ Prime Attributes {A,B,D,E,H}
⇒ Non Prime Attributes {C}```

### Incoming search terms:

• prime attribute
• non prime attribute
• Prime attribute in dbms
• prime attributes
• prime and non prime attribute
• what is non prime attribute
• prime and non prime attributes
• whAt is prime attribute
• non prime attributes
• prime and non prime attribute in dbms