DAY 11
ATTRIBUTES : Are the properties which defines the entity .
1. Key attribute / Candidate key : An attribute which is used to identify a
record uniquely from a table is known as key attribute .
Ex: Phone_No , mail_id , aadhar , pan , ration , passport , dl , bank a/c
2. Non key attribute : All the attributes other than key attributes .
Ex : Name , age , gender , dob
3. Prime key attribute : Among the key attributes an attribute is chosen to
be the main attribute to identify a record uniquely from the table is known
as prime key attribute .
Ex: Phone_No .
4. Non-prime key attribute : All the key attributes other than Prime key
attributes
Ex : mail_id , aadhar , pan , ration , passport , dl , bank a/c .
5. Composite key attribute : It is combination of two or more non key
attributes
which is used to identify a record uniquely from the table .
> Composite key is found whenever there is no key attribute .
Ex: ( name , age , dob , address )
6. Super key attribute : It is a set of all key attributes .
Ex: {Phone_No , mail_id , aadhar , pan , ration , passport , dl , bank a/c }
7. Foreign key attribute : It is an attributes which behaves as an attribute of
another
entity to represent the relationship .
Ex: Dno
Attributes
Name , age , color , weight , height , occupation Human Being
Nationality , address , gender , dob , job ,
Entity
mail_id , aadhar , phone no
Pan , ration , passport , dl , bank a/c …..
New Section 1 Page 1
mail_id , aadhar , phone no
Pan , ration , passport , dl , bank a/c …..
FUNCTIONAL DEPENDENCY :
"THERE EXISTS A DEPENECY SUCH THAT AN ATTRIBUTE IN A
RELATION DETERMINES ANOTHER ATTRIBUTE ".
Example :
EMP - ( EID , ENAME )
EID ----> ENAME : functional dependency .
TYPES OF FUNCTIONAL DEPENDENCIES :
1. TOTAL FUNCTIONAL DEPENDENCY
2. PARTIAL FUNCTIONAL DEPENDENCY
3. TRANSITIVE FUNCTIONAL DEPENDENCY
1. TOTAL FUNCTIONAL DEPENDENCY:
If an attribute in a relation determines all the other attributes it is known as
TFD
OR If all the attributes are dependent on a single attribute then it is known
as TFD
EMP - ( EID , ENAME , SAL , DOB )
EID * KEY ATTRIBUTE
EID - > ENAME
EID - > SAL
EID - > DOB
:- EID ---> ( ENAME , SAL , DOB ) :- total functional
dependency.
2. PARTIAL FUNCTIONAL DEPENDENCY:
There exists a dependency such that a part of composite key attributes
New Section 1 Page 2
There exists a dependency such that a part of composite key attributes
determines
another attribute uniquely .
CUSTOMER - ( CNAME , ADDRESS , MAIL_ID ,
PHONE_NO )
Customer
CNAME ADDRESS MAIL_ID PHONE_NO
Smith Mysore smith@[Link]
Miller Bangalore 1001
Scott Mangalore scott@[Link]
Adams Mysore 2002
Scott Delhi scott@[Link] 3003
( PHONE_NO , MAIL_ID ) ---- Composite key attribute
PHONE_NO ---> CNAME , ADDRESS
MAIL_ID --- > CNAME , ADDRESS :- partial functional dep .
3. TRANSITIVE FUNCTIONAL DEPENDENCY
There exists a dependency such that an attribute is determined by a non-key
attribute
, which is intern determined by a key attribute .
CUSTOMER - ( CID , CNAME , PINCODE , CITY)
Customer
CID CNAME PINCODE CITY
1 Smith 560019 Bangalore
2 Miller 560019 Bangalore
3 Scott 312121 Pune
4 Adams 123456 Mumbai
5 Scott 123456 Mumbai
Key attribute
Non key attribute
CID - CNAME
New Section 1 Page 3
5 Scott 123456 Mumbai
Key attribute
Non key attribute
CID - CNAME
- PINCODE
- CITY
Redundancy : The repetition of unwanted data is known as redundancy .
Anomaly : The side effects caused during DML operations is known as
Anomaly.
TOTAL PARTIAL TRANSITIVE
No Redundancy Redundancy Exists Redundancy Exists
No Anomalies Anomalies are Present Anomalies are Present
New Section 1 Page 4