The super key would be EMPLOYEE-ID (EMPLOYEE_ID, EMPLOYEE-NAME), etc. Hence, this combination can also be a key. A super key is a superset of a candidate key.įor example: In the above EMPLOYEE table, for(EMPLOEE_ID, EMPLOYEE_NAME), the name of two employees can be the same, but their EMPLYEE_ID can’t be the same. Super key is an attribute set that can uniquely identify a tuple. The rest of the attributes, like SSN, Passport_Number, License_Number, etc., are considered a candidate key. The candidate keys are as strong as the primary key.įor example: In the EMPLOYEE table, id is best suited for the primary key. Except for the primary key, the remaining attributes are considered a candidate key.A candidate key is an attribute or set of attributes that can uniquely identify a tuple.For each entity, the primary key selection is based on requirements and developers.In the EMPLOYEE table, we can even select License_Number and Passport_Number as primary keys since they are also unique. In the EMPLOYEE table, ID can be the primary key since it is unique for each employee. The key which is most suitable from those lists becomes a primary key. An entity can contain multiple keys, as we saw in the PERSON table. It is the first key used to identify one and only one instance of an entity uniquely.In the PERSON table, passport_number, license_number, SSN are keys since they are unique for each person. It is also used to establish and identify relationships between tables.įor example, ID is used as a key in the Student table because it is unique for each student. It is used to uniquely identify any record or row of data from the table.Keys play an important role in the relational database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |