Removing Partially-dependent Columns (Normalizing the Database)

From InterBase
Jump to: navigation, search

Go Up to Normalizing the Database


Another important step in the normalization process is to remove any non-key columns that are dependent on only part of a composite key. Such columns are said to have a partial key dependency. Non-key columns provide information about the subject, but do not uniquely define it.

For example, suppose you wanted to locate an employee by project, and you created the PROJECT table with a composite primary key of EMP_NO and ­PROJ_ID.

PROJECT table
EMP_NO PROJ_ID LAST_NAME PROJ_NAME PROJ_DESC PRODUCT

44

DGPII

Smith

Automap

blob data

hardware

47

VBASE

Jenner

Video database

blob data

software

24

HWRII

Stevens

Translator upgrade

blob data

software

The problem with this table is that PROJ_NAME, PROJ_DESC, and PRODUCT are attributes of PROJ_ID, but not EMP_NO, and are therefore only partially dependent on the EMP_NO/PROJ_ID primary key. This is also true for ­LAST_NAME because it is an attribute of EMP_NO, but does not relate to ­PROJ_ID. To normalize this table, we would remove the EMP_NO and ­LAST_NAME columns from the PROJECT table, and create another table called EMPLOYEE_PROJECT that has EMP_NO and PROJ_ID as a composite primary key. Now a unique row exists for every project that an employee is assigned to.