0% found this document useful (0 votes)
4 views8 pages

DB Assigment 2

The document outlines the normalization process of invoice data from Zam Zam Super Store, transforming it from an unnormalized flat table to a structured relational database through First, Second, and Third Normal Forms. It details the issues with the original data structure, such as redundancy and anomalies, and presents the final relational schema with separate tables for Store, Bill, Item, and BillItems. The report concludes that this normalized structure enhances data integrity and supports efficient database operations.

Uploaded by

bscs23f17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views8 pages

DB Assigment 2

The document outlines the normalization process of invoice data from Zam Zam Super Store, transforming it from an unnormalized flat table to a structured relational database through First, Second, and Third Normal Forms. It details the issues with the original data structure, such as redundancy and anomalies, and presents the final relational schema with separate tables for Store, Bill, Item, and BillItems. The report concludes that this normalized structure enhances data integrity and supports efficient database operations.

Uploaded by

bscs23f17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Assignment 2

Database Systems

Topic: Normalization

1 Sawaira Tabbasum NUM-BSCS-2023-17

Department of Computer Science


Namal University Mianwali
10 th June, 2025
Contents
1. Introduction ....................................................................................................................................3
2. Original Invoice Data Overview.......................................................................................................3
3. Normalization Process.....................................................................................................................4
3.1 Unnormalized Form (UNF)........................................................................................................4
3.2 First Normal Form (1NF)...........................................................................................................5
3.3 Second Normal Form (2NF).......................................................................................................5
3.4 Third Normal Form (3NF) .........................................................................................................6
4. Relational Schema ..........................................................................................................................8
5. Conclusion .....................................................................................................................................8
1. Introduction
This report presents the process of normalizing invoice data from a retail store to a well-
structured relational database. The purpose of normalization is to organize data efficiently,
reduce redundancy, avoid anomalies during data operations (insert, update, delete), and ensure
data integrity.

The original invoice data contains both bill-level and item-level details in a single flat table. This
structure causes repetition and potential anomalies. The report walks through transforming this
data from its initial Unnormalized Form (UNF) to First Normal Form (1NF), Second Normal
Form (2NF), and finally Third Normal Form (3NF).

2. Original Invoice Data Overview


Store Name: Zam Zam Super Store

Location: Fahed Plaza Gulberg, Chowk Mianwali

Contact: 0300-0344999

Bill Number: 464188

Date: 2025-02-27

Time: 6:15 PM

Invoice Line Items:


Item Name Quantity Rate Discount Amount
Nescafe Chilled Mocha 220ml 1 170 0 170
Chat Masala (Shan) 3 120 60 300
Vermicelli National 3 85 0 255
Sandwich Spread (Youngs) 3 250 0 750
Maktab Food Green Chili Pickle 1 520 0 520
Heat Pad Medium 1 370 0 370
Daal Nimko 100g 1 50 0 50
Gross Total: Rs. 2475

Total Discount Given: Rs. 60 (only on Chat Masala)

Net Total (Amount Due): Rs. 2415


3. Normalization Process
3.1 Unnormalized Form (UNF)
In UNF, all data is stored in a single flat table where the bill information is repeated for every
item sold in that bill.

Store
Bill No Date Time Item Name Qty Rate Discount Amount
Name
Zam Zam
Nescafe Chilled
464188 2025-02-27 6:15 Super 1 170 0 170
Mocha 220ml
Store
Zam Zam
Chat Masala
464188 2025-02-27 6:15 Super 3 120 60 300
(Shan)
Store
Zam Zam
Vermicelli
464188 2025-02-27 6:15 Super 3 85 0 255
National
Store
Zam Zam
Sandwich Spread
464188 2025-02-27 6:15 Super 3 250 0 750
(Youngs)
Store
Zam Zam Maktab Food
464188 2025-02-27 6:15 Super Green Chili 1 520 0 520
Store Pickle
Zam Zam
Heat Pad
464188 2025-02-27 6:15 Super 1 370 0 370
Medium
Store
Zam Zam
Daal Nimko
464188 2025-02-27 6:15 Super 1 50 50
100g
Store

Problems with UNF:

• Data redundancy: Store and bill details are repeated for each item.

• Insertion anomaly: Cannot add a bill without items.

• Update anomaly: If store details change, they must be updated in multiple rows.

• Deletion anomaly: Deleting all items of a bill deletes the entire bill information.
3.2 First Normal Form (1NF)
1NF requires each column to contain atomic (indivisible) values and eliminates repeating groups.
Since the data is already atomic (each field holds one value), UNF is already in 1NF.

3.3 Second Normal Form (2NF)


2NF requires removal of partial dependencies — no non-key attribute should depend on part of a
composite primary key.

Identifying functional dependencies is crucial for further normalization.

• BillNo → Date, Time, StoreName

• ItemName → Rate

• (BillNo, ItemName) → Qty, Amount, Discount

Here, the primary key for the entire table is composite: (BillNo, ItemName).

In the original table:

• Date, Time, StoreName depend only on BillNo (partial dependency).

• Rate depend only on ItemName (partial dependency).

Decomposition:

• Create a Bill table with (BillNo, Date, Time, StoreName).

• Create an Item table with (ItemName, Rate).

• Create a BillItems table with (BillNo, ItemName, Qty, Amount, Discount).

Tables:
Bill Table

Bill No Date Time Store Name


464188 2025-02-27 6:15 Zam Zam Super
Store
Item Table

Item Name Rate (Rs.)


Nescafe Chilled Mocha 220ml 170
Chat Masala (Shan) 120
Vermicelli National 85
Sandwich Spread (Youngs) 250
Maktab Food Green Chili Pickle 520
Heat Pad Medium 370
Daal Nimko 100g 50

BillItems Table

Bill No Item Name Qty Discount Amount (Rs.)


Nescafe Chilled
464188 1 0 170
Mocha
Chat Masala
464188 3 60 300
(Shan)
Vermicelli
464188 3 0 255
National
464188 Sandwich Spread 3 0 750
Green Chili
464188 1 0 520
Pickle
Heat Pad
464188 1 0 370
Medium
Heat Pad
464188 1 0 370
Medium

3.4 Third Normal Form (3NF)


3NF requires removing transitive dependencies. That means non-key attributes cannot depend on
other non-key attributes.

To achieve 3NF:

• Store information (Name, Location, Contact) should be in a separate Store table.

• Similarly, each item will have an ItemID as a unique identifier instead of Item Name.

Final relations:

• Store(StoreID, StoreName, Location, Contact)

• Bill(Bill No, Date, Time, StoreID)


• Item(ItemID, ItemName, Rate)

• BillItems(BillNo, ItemID, Qty, Discount, Amount)

Tables:
Store Table

StoreID StoreName Location Contact


Fahed Plaza Gulberg,
1 Zam Zam Super Store 0300-0344999
Chowk Mianwali

Bill Table

Bill No Date Time StoreID


464188 2025-02-27 6:15 1

Item Table

ItemID ItemName Rate


1 Nescafe Chilled Mocha 170
2 Chat Masala (Shan) 120
3 Vermicelli National 85
4 Sandwich Spread (Youngs) 250
5 Green Chili Pickle 520
6 Heat Pad Medium 370
7 Daal Nimko 100g 50

BillItems Table

Bill No ItemID Qty Discount Amount


464188 1 1 0 170
464188 2 3 60 300
464188 3 3 0 255
464188 4 3 0 750
464188 5 1 0 520
464188 6 1 0 370
464188 7 1 0 50
4. Relational Schema

5. Conclusion
This report thoroughly details the normalization of the Zam Zam Super Store invoice data. By
decomposing the original flat data into well-structured relational tables, we reduce redundancy
and enhance data integrity. The use of StoreID, BillNo, and ItemID as keys establishes clear
relationships. The discount is appropriately maintained at the transactional level in BillItems to
reflect real-world billing scenarios.

This normalized database structure is ready for implementation in any relational database
system, supporting efficient querying, updates, and management.

You might also like