Beruflich Dokumente
Kultur Dokumente
This violates the first normal form, and would result in large
rows, wasted space (where an invoice had less than the maximum
number of line items).
First form normalization requires you make a separate line item
table, with it's own key (in this case the combination of invoice
number and line number).
First form normalization
Second Normal Form
First form
normalization
Second form
normalization
Third form
normalization
PK user_id
first_name
last_name
phone
nickname email
address PK phone_id
city PK email_id
province country_code
postal_code address number
country extension
web_url
company
department
picture
notes
Forming Relationships
Three Forms •
One to (zero or) One –
One to (zero or) Many –
Many to Many –
One to One •
?Same Table –
One to Many •
Place PK of the One in the Many –
Many to Many •
Create a joining table –
Joining Tables
user phone
user_phone
PK user_id PK phone_id
PK,FK1 phone_id
PK user_id
first_name country_code
last_name number
type
nickname extension
address
city
province
postal_code
country email
web_url
PK address
picture
notes
FK1 user_id
email_format
Our User Table
first_na last_nam company department
me
Mike e
Hillyer MySQL Documentation
Tom Jensen CPNS Finance
Ray Smith CPNS Documentation
user phone
user_phone
PK user_id PK phone_id
PK,FK1 phone_id
PK user_id
first_name country_code
last_name number
type
nickname extension
address
city
province
postal_code
country email
web_url
PK address
picture
notes
FK1 user_id
email_format
Second Normal Form
Table must be in First Normal Form •
Remove vertical redundancy •
The same value should not repeat across rows –
Composite keys •
All columns in a row must refer to BOTH parts –
of the key
Benefits •
Increased storage efficiency –
Less data repetition –
Satisfying 2NF
user_phone
phone
user
PK,FK1 user_id
PK phone_id
PK user_id PK,FK2 phone_id
country_code
first_name extension
number
last_name
type
nickname
address
city
email province
postal_code user_company
PK address country company
PK,FK1 user_id
web_url
PK,FK2 company_id PK company_id
FK1 user_id picture
format notes
department name