See the table below.
customer code | customer name | address | phone No |
The primary key is the customer code, and the other items are the customer name, address, and phone No. The relationship between the primary key and other items is called functional dependence.
To add a little more detail, if y=x (a function in elementary mathematics) and x is, say, 1, then y is 1. y=2x, then x is 1 and y is 2. Well, of course, if x is determined, then y is determined. This state of affairs is called y being functionally dependent on x.
Similarly, once the customer code is determined, the customer name, address, and phone No. are determined. In other words, the customer name, address, and phone number are functionally dependent on the customer code.
A relational database consists of keys and other items. The key is the item on the side of the function dependencies described earlier, where the other values are determined once the key is known.
There are several types of keys. A key item that can identify a record from a table is called a candidate key. The central key item is called the primary key. A key item may consist of a single item or a combination of items.
Take bank accounts, for example...
account number | store number | customer number | Name | address | balance |
In this case, the candidate key is a combination of the account number, store number, and customer number.
The primary key is one of these, so if the table is, for example, account information, the account number is the primary key, and if it is a customer table, the store number and customer number are the primary keys.
A normalized table has only key entries and other entries. Conversely, normalization is the process of reducing a table to its primary key and its functional dependencies.
In this section, we have discussed functional dependencies, keys and their relationships. This completes the basic concepts for learning normalization.