You are on page 1of 5

ASSIGNMENT 2

Name: Dharti Patel


Student ID: 8807575
Section: 7

The Gill Art Gallery wishes to maintain data on their customers, artists and paintings. They
may have several paintings by each artist in the gallery at one time. Paintings may be bought
and sold several times. In other words, the gallery may sell a painting, then buy it back at a
later date and sell it to another customer.
Normalize the data based on the information above as much as possible as UNF, 1NF, etc.
Provide any justification as needed wherever necessary.

Step 1: UNF: Un-Normal Form

The given form will be stored in below fat formed database table as below:
CustomerID Fname Lname Street City State ZipCode Artist Title Customer_Purchase_Date
Sales_Price

Where Artist, Title, Customer_Purchase_Date, Sales_Price will have multiple values in it for
a single record as below sample:

Fname Lname Street City State ZipCode Artist Title Customer_Purchase_Date


Sales_Price
Jacksone Elizabeth 123-4th Fonthil, L3J 03-Carol Laught 17/09/2000 70000
Avenue ON 4S4 Channing with 05/11/2000 1700
15- Teeth
Dennis South
Frings towards
Emerald
Sea

The above table is not normalized in any normal form.


Step 2: 1NF: 1st Normal Form
The database is considered to be in the 1NF if:
1.1 Primary key is identified for the table.
1.2 There is no multiple values attribute in the table.
1.3 Each value in the tuple is storing single information.

Let’s consider the table as below values:


Fname Lname Street City State Artist Title Customer_Purchase_Date Sales
_Pric
e

Jacksone Elizabeth 123-4th Fonthil, L3J 03-Carol Laught 17/09/2000 7000


Avenue ON 4S4 Channing with 0
Teeth

Jacksone Elizabeth 123-4th Fonthil, L3J 15- South 05/11/2000 1700


Avenue ON 4S4 Dennis towards
Frings Emerald
Sea

Normalizing the table:


The above table shows that it does not have multiple values in single row.
 Consider Customer Name, there is no way to uniquely identify the customer as the
Fname and Lname can be same for any customer. Let’s add Customer_ID for the
Customer’s identification.

 Consider column Artist, it has ID as well as Name. Let’s break the column Artist to
Artist_ID and Artist_Name considering that Artist_ID is unique.

The final table will become as below:


Custom Fna Lna Str Ci Sta ZipC Artist_ Tit Customer_Purch Sales_
erID me me eet ty te ode Name le ase_Date Price
Artist
_ID

Identifying Primary Key:


As per the given instructions, a customer can buy same painting multiple times, thus
(CustomerID, Title) is not enough to store the data uniquely. Consider (CustomerID,
Title,Customer_Purchase_Date) as compsite key for the relation.
Now the table has a Primary key as well as other conditions satisfying in it for 1NF. Thus the
table is in 1NF now.
Step 3: 2NF: 2nd Normal Form:

A database table is considered to be in 2nd Normal form if:


2.1 Table is in 1NF (after achieved in above step)
2.2 All non key attributes are fully functional dependent on key attribute. Functional
dependency means that one attribute can be determined from the value of other attribute.

Functional dependencies in obtained 1NF table:


CustomerID -> Fname, Lname, Street,City, State, ZipCode
Artist_ID -> Artist_Name, Title
Title -> Sales_Price
CustomerID, Title-> Customer_Purchase_Date

Removing functional dependencies from non-key attributes and making 2NF tables:
Break the table as below to store the functional dependencies independently in separate table:

Customer Table: The table will have CustomerID as primary key.


CustomerID Lname Street City State ZipCode
Fname

Artist Table: The table will have Artist_ID as primary key:


Artist_ID Artist_Name

Painting: This table will store the Title as primary key assuming that title is unique for all
paintings having a Buy_Date:
Title Sales_Price Buy_Date

Sale Table: The table will have the Sale details with (CustomerID, Title,
Customer_Purchase_Date) as primary key. This table has the assumption that the customer will
buy the same painting again on different Customer_Purchase_Date. The same is shown as
below:
CustomerID(fk) Customer
Title(fk) Purchase_Date

**CustomerID is foreign key from Customer


Title is foreign key from Painting
The above 4 tables are in 2NF now.

Step 4: 3NF: 3rd Normal Form


The table is considered to be in 3rd Normal form if :
3.1 Table is already in 2NF.
3.2 There is not transitive dependency in attributes where one non-key attribute Z
depends on another non-key attribute Y which depends on key attribute X. It is denoted as
X -> Y -> Z thus X - > -> Z
The tables obtained in above step are in 2NF.

Let’s consider the table Customer’s Address column:


Street City State ZipCode

The table has transitive dependency as:


CustomerID -> Street, City, State; says that (Street, City, State) depends on CustomerID
Street, City, State -> ZipCOde; says that all three address attributes can be determine Zipcode

Thus the table has transitive dependency.


Break the table as below:
Customer Table: The table will have CustomerID as primary key and Address_ID as foreign
key reference Address table:
CustomerID Lname
Fname Address_ID(FK)

Address Table: The table will have Address_ID as primary key:


Address_ID Street City State ZipCode
Artist Table: The table will have Artist_ID as primary key:
Artist_ID Artist_Name

Painting: This table will store the Title as primary key assuming that title is unique for all
paintings having a Buy_Date:
Title Buy_Date
Sales_Price

Sale Table: The table will have the Sale details with (CustomerID, Title,
Customer_Purchase_Date) as primary key. This table has the assumption that the customer will
buy the same painting again on different Customer_Purchase_Date. The same is shown as
below:
CustomerID(fk) Customer_Purchase_Date
Title(fk)

CustomerID is a foreign key from Customer table


Title is a foreign key from Painting table

You might also like