Lec 15 - Keys and Database Users
Lec 15 - Keys and Database Users
• Given below are the examples of super keys since each set can uniquely
identify each student in the Student table-
Candidate
key It is called a minimal super key or
irreducible super key.
3 candidate keys:
1) StudID
2) Rollno
3) Email
PRIMARY KEY is a column or group of columns in a
table that uniquely identify every row in that table.
Key
It can be a single attribute of the table or
combination of attribute.
•The key which is most suitable from those lists become a primary key.
•In the EMPLOYEE table, ID can be primary key since it is unique for each employee.
•In the EMPLOYEE table, we can even select Lic_Num and PassportNum as primary
key since they are also unique.
Rules for defining Primary key:
There is no
Foreign key can In fact, foreign key
restriction on a
take the NULL is not unique most
foreign key to be
value. of the time.
unique.
• Key that consists of two or more attributes that uniquely identify any
record in a table is called Composite key.
• But the attributes which together form the Composite key are not a
key independently or individually.
Why we need a Key?
Naive or
parametric end • canned queries and updates
users
• Implement complex
specifications (business logic) as
programs
• DBMS
Persons whose designers and
job involves implementers
Workers behind design,
development,
• Tool
Developers
the scene operation and
maintenance • Operator and
of DBMS
software are: maintenance
personal
DBMS system Operators and
designers and Tool developers maintenance
implementers personnel