CIS4365: Database Applications Fall, 2017 |
How are keys used in RDBMS? There are various KEYS used in today’s RDBMS, keys are use to define entity relationships, determination of values, and function dependence. Lets look in more detail at the use of each key: 1. Primary Key. Are field names that can uniquely identify rows in a table, out of these fields one will be chosen making it the Primary Key. The primary key is used to uniquely identify records from a table that will later be used to link one table to another. These keys cannot be null or no duplicates can exist within the same table. These fields that are chosen as primary keys are also chosen because of convenience, comprehension, or performance. 2. Composite Key. Are field names that together can produce uniqueness in rows within a table. The primary key will be assigned, as stated in the primary key definition, but with more than one field name. 3. Super Key. Is just another name convention used for the naming of primary keys or composite keys. 4. Candidate Key. Candidate keys are those fields that could be used as primary keys but where not chosen to be a primary key. An example would be where in a table you have employee ID and employee social security number, both can be used as primary keys but employee ID was ultimately chosen thus making the SSN field a candidate key. 5. Secondary Key. These keys are field names that are used for retrieval purposes of information. An example would be if you wanted to retrieve all the employees that live in zip code 79902. This field name would be a secondary key. 6. Foreign Key. This is a very important key mainly because it is through foreign keys that relationships between tables are established and all referential and integrity constraints are based on. This key is a field name that is required to match another field name of another table, which is the primary key field name of that table.
|