Oh my goodness we’re finna hit the normal forms
Normalization: reduce anomalies
Anomolies:
A functional attribute shows a connection between attributes within a relation.
If A determines the value of B, aka B depends on A, write this:
A → B
If we know the value of A, then we can determine the value of B and only B.
Example: EMPLOYEE(EmployeeID, firstname, lastname)
EmployeeID → Firstname, Lastname
In the above example, EmployeeID is a determinant.
Functional dependencies can require a set or determine a set.
A → B, C
or
A, B → C
Consider:
Name | DOB | Dept |
---|---|---|
Joe | 12/15/60 | Acct |
Bill | 4/11/71 | Acct |
Joe | 12/15/60 | Mgt |
Tom | 8/23/73 | Ship |
Al | 12/15/60 | Acct |
In the above table, Name → DOB. However, Name does not determine Dept. DOB does not determine Name or dept, and dept does not determine name or dob.
However, it can be said that Name, Dept → DOB.
This is step 1. Find all the ones you can.
All the Determinants that could be primary keys are called candidate keys.
We must pick among the candidates which key shall become the primary key.
Composite determinants, candidate keys, and primary keys are all allowed.
Then it becomes your actual primary key
MyCourses has a ‘normalization process reference’ in week5
“A relation is in second normal form if it is in first normal form and all of its non-key attributes are dependent on the entire primary key”
When the primary key of a relation appears in another relation, it is a foreign key. This forms relationships between relations.
In type, foreign keys are shown in italics. When hand-writing, use a dashed underline.
Here’s my attempt at a dashed underline in markdown
The values of foreign key attributes must reference a valid, existing primary key.