Mapping and Normalization

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

ISY 221 Database management

systems
Mapping from logical to physical
Table Diagram
Relatioship mapping

 One- many
 Recursive one-many
 Many-many
 One-one
 Barred
 Arcs
 Supertype and suptypes
One- many
 The foreign key is place on the many side of the relatioship

SUPLLIER PRODUCT
#Sup_ID #Product_ID
*Sup_name *Product_name

SUPPLLIER PRODUCTS
S
Key type Optionality Column name Key type Optionality Column name
PK * SUP_ID PK * Product_ID
* SUP_NAME * Product_name
FK * SUP_ID
Recursive one-many

EMLOYEE
#emp_ID
*EMP_name

EMPLOYEE
SKey type Optionality Column name
PK * Emp_ID
* EMP_name
FK * MNG_ID
Many-to-many

CRITICS MOVIES
#critic_ID #MOVIE_ID
*MOVIE_name
Intersection entity
CRITICS MOVIES
#critic_ID #MOVIE_ID
*MOVIE_name

REVIEW Key type Optionality Column name


*rating
Key type Optionality Column
PK * MOVIE_ID
name
* MOVIE_name
PK * Critic_ID

Key type Optionality Column


name
* rating
PK,FK1 * MOVIE_ID
PK,FK2 * CRITIC_ID
One to one

STUDENT BAG
#Bag_ID
#S_ID

STUDENTS BAGS
Key type Optionality Column Key type Optionality Column
name name

PK * S_ID PK * BAG_ID
FK o B_ID
barred

ACCOUNT BANK
#account_ID #bank_ID
*bank_name

BANKS
Key type Optionality Column Key type Optionality Column
name name
PK * Account_ID PK * Bank_ID
PK,FK * Bank_ID * Bank_name
ARCS Key type Optionality Column
name
PK * id
* name
* Contact
name

Key type Optionality Column


name
Key type Optionality Column name PK * id
PK * id * First name
* Start date * lastname
* Expiration date
o termination
FK1 o Com_id
FK2 o Customer_ID
SUPERTYPE/SUPTYPE

MAPPING

single table
two table
Single table
Key type Optionality Column
name
PK * id
* First name
* Last name
o salary
o Hourly rate
* type
FK1 o Agn_id
FK2 o Dep_id
FK3 o Mng_id
Two table

SHIRTS
SHOES
Key type Optionality Column name Key type Optionality Column name
* Sleeve length * size
* Neck size * Buckle style
o Collar style o Heel height
PK * id PK * id
* material * material
Fk1 o Taylor_id FK1 o Cob_id
FK2 o Manu_id FK2 o Manu_ID
Normalization

1 st 2nd 3 rd

No partial No transitive
No multi-value dependency dependency
 In the following table the primary key is composed of vihcle_ID and manufacturer_ID, Vihcle_model depends on
vihcle_ID, is the table in the second normal form, if not bring it to the second nomal form
 ANSWER: No, there is a partial dependecy(functional dependency) therefore the table is not in the second form

Vihcle_ID Manufacturer_ID Vihcle_model

Vihcle_ID Manufacturer_ID

Vihcle_ID Vihcle model


 In the following table the primary key is the person_ID the attribute is_overweigth depends
on the BMI, is the table in the third normal form? If not bring it to the third normal form.
 No, there is a transitive dependency

Person_ID BMI Is_overweight

Person_ID BMI

BMI Is_overweight
 In the following table the primary key is book_id, the attributr nationality depends on the
book_author, is the table in the second normal form?
 ANSWER: yes, it is in the second normal form, because there’s no partial
dependency(functional dependency)

Book_id Book_author nationality

You might also like