You are on page 1of 6

RELATIONAL DATABASE OF QATAR FLOUR MILLS

INTRODUCTION
Qatar Flour Mills is certified by SGS standards of
quality, ISO 9001:2008, and ISO 22000:2005, and
also has an HACCP certification. Apart from being
the largest flour mill in Qatar, we also have one of
the most expansive distribution networks in the
country. The business philosophy at QFM emanates
from the three pillars of long-term value generation
– right thought, right intention, and right action. This
philosophy guides us as we strive to serve our
customers and business partners every day. We have
designed our products to reflect the consumers we
serve – multidimensional, dynamic, bold, and
modern yet rooted in tradition.

We are committed to building long-term relationships by continuously improving our


responsiveness, flexibility and manufacturing quality. We aim to exceed our customers’
expectations for quality, service and value. Our commitment is to ensure consumer satisfaction
and value.

1. In our proposed system of Qatar flour mills we have seven entities which will relate with
each other in the entire procedure these entities
are
a) Clients
b) Order
c) Money
d) Mill
e) Employees
f) Product
g) Delivery
Order will be placed by client. A client can be any person
from a common person to a retailer or a storekeeper. He will place order. This order will have
special status like that order is complete, pending or finished. A client can place multiple orders
at same time. Then mill will try to procure are produce this order from the storage. And
Employees are working in mill. The client will interact with employees when order has to deliver
or when order Is not delivered in case of any query.
2. As Qatar Flour mills is Government Institution So it’s difficult to Track its data because
its confidential. So we tried to add Dummy data in our database. According to our data
we having following columns for every entity
Table Name Attributes Type PK or FK FK Reference
of table

Clients name Varchar(40)


Id Varchar(25) PK
status Varchar(40)
bill Varchar(40)
Order name Varchar(40)
Id Varchar(25) PK
status Varchar(40)
bill Varchar(40)

Money Varchar(40)
Money id Varchar(25) PK
status Varchar(40)
Order name Varchar(40)
Mill Order id Varchar(25) FK Order
status Varchar(40)
Product name Varchar(40)
Product id Varchar(25) FK Products
Employee Varchar(40)
Employee Name Varchar(40)
Id Varchar(25) PK
Designation Varchar(40)
Age Varchar(40)

Product Product name Varchar(40)


Product id Varchar(25) PK

Delivery Delivery name Varchar(40)

Delivery_Id Varchar(25) PK
3. NORMALIZATION
Cardinalities
The cardinalities are defining in way that relation between client and order is many to many so
we normalized it and created another table with name Order placement due to which relation
between client and order placement becomes one to many and relation between order and order
placement become one to many. Relation between order and cash or money is one to many. The
relation between cash and Mill is one to many. The relation between mill and product is one to
many and relation between mill and delivery is also one to many and relation between Mill and
employee will be one to many and relation between order and delivery is also one to many.

Normalization
Client
Id Name Status balance bill History
Order
Id Name Status balance
Money
Id balance Status
Mill
Id Product Product_id Order name Order id Status
Name
Employee
Id Name Designation Age

As client and Order has many to many relations so to remove partial dependency we will create
another table having primary keys of both table
Order Placement
Order Id Client id Order name

3rd Normal Form:


We will remove transitive dependency in it
Mill will be further divided in two tables
Id Product Product_id status
Name

Id Order Name Order_id Status

Order placement will divide in two tables


Order Id Order name

Client id Order name

Qatar flour mill ERD without normalization


Qatar flour mill ERD with normalization

4. Database Queries:

a. In query no 1 we are searching for Client name, id, and status so that their order status is
completed and the tables which we selected for this are client and order.
Select Client_name,Client_id,Client_Status From Client ,Order Where Client_id == Order_id
&& Status == “Completed”;
b. In query no 2 we are searching for Client name, id, product id, product name, order id
and order name so that their ids match with each other and the tables which we selected
for this are client, product and order.
Select Client_name,Client_id,Product_id,Product_Name,Order_name, Order_id From Client
,Order,mill Where Client_id == Order_id && Order_id == Product_id;

c. In query no 3 we are searching for Client name, id, and status so that their order status is
Pending and the tables which we selected for this are client and order.
Select Client_name,Client_id,Client_Status From Client ,Order Where Client_id == Order_id
&& Status == “Pending”;
d. In query no 4 we are searching for Client name, id, and status so that their order status is
finished and the tables which we selected for this are client and order.
Select Client_name,Client_id,Client_Status From Client ,Order Where Client_id == Order_id
&& Status == “Finished”;
e. In query no 5 we are searching for Client name, id, and status so that their order bill is
less than 10000 rayals . it will give us all results which have price less than 10000 rayals
Select Client_name,Client_id,Client_Status From Client ,Order Where Client_id == Order_id
&& Status == “Completed” && Order.bill <= 100000 Rayal;
f. In query no 6 we are searching for Client name, id, and status so that their order bill is
Greater than 10000 rayals . it will give us all results which have price less than 10000
rayals
Select Client_name, Client_id,Client_Status From Client ,Order Where Client_id == Order_id
&& Status == “Completed” && Order.bill >= 100000 Rayal;

You might also like