Assignment Of Database Management System

Group members:
Kinza Amir Abiha Kazim Roll no. 24 Roll no. 40 "A" B.com (hons) 6th semester 22-06-2008

Section: Class: Date: Submitted to:
Karamat”

“Prof. Shahid

Hailey College of Commerce

UNIVERSITY OF THE PUNJAB
ANALYSIS OF EHSAN CHAPPAL STORE (PVT) Limited
2nd Floor, Paris Market Anarkali, Lahore. 1000,000 150,000 Ehsan Rab Siddiqui 10/23/2000 10,000 1,500

Registered Office Address Authorized Capital Paid-up-Capital CEO Name Incorporate Date Authorized Capital Shares Paid-up-Capital Shares

HISTORY:
They are a small family-owned chain of ladies footwear and accessories retail outlets. The first outlet was opened in the newly constructed Bano Bazaar in Lahore's famous market Anarkali by Mr. Fazal-e-Rab Siddiqui in 1954. It was a small shop measuring just 72 square feet located in the

busy side lane named after his Ehsan. His idea was to give his customers good value for money. Soon he became famous for his wide range of comfortable and durable ladies chappals (sandals and slippers). The success followed slowly but surely. In a few years the name Ehsan Chappal Store becomes synonym for fairly-priced comfortable and durable ladies sandals. Soon enough the namesake Mr. Ehsan Rab Siddiqui joined his father after completing his secondary education and the business started to expand. The shop has since expanded four times to become the largest shoe shop in the whole bazaar with an area of more than 2000 square feet. For over four decades it has been the bustling place ever crowded with the ladies of Lahore trying to find the best match for their feet from a wide range of designs. The shop displays less than 2000 designs. Not only chappals but every kind of ladies footwear is now on display. And that's not all in 1985 a new smaller place was acquired nearby to display the traditional variety of khussas and kolhapuri chappals. In 1997 a new branch was opened in Liberty Market, Gulberg to cater the needs of the growing city of Lahore. Liberty Market is now the largest and most posh market in the city. And Ehsan Chappal Store was an instant success there. The old customers that had moved out to the suburbs of Lahore were glad to have their favorite shop nearer to home. And it showed in the graph of sales of Liberty outlet which increased steadily. The shop was expanded in 1999 to contain the ever-increasing number of customers.

INTRODUCTION:
Ehsan Chappal Store (Pvt) Ltd owns multiple brands of ladies and girls' footwear, bags and accessories including ecs, elements, effects and ecircles. All these brands are exclusively available at ecs stores located at most convenient locations in most major cities of Pakistan. Ecs stores display largest variety of ladies footwear and accessories available at any single outlet. Ecs is undoubtedly the most famous ladies footwear brand in the country with the history of over 50 years. Unsurpassed quality and contemporary designing are the hallmarks of all Ehsan Chappal store brands. The CEO of ECS is Ehsan Rab Siddiqui.

BRANCHES
1. Anarkali, Lahore 2. Liberty, Lahore 3. Defence, Lahore 4. Township, Lahore 5. Model Town, Link Road, Lahore 6. The Mall, Lahore 7. Saddar, Rawalpindi 8. F 10 Markaz, Islamabad 9. Peoples Colony, Faisalabad 10.satellite Town, Gujranwala

EXECUTIVE SUMMARY
It is a matter of common observation that collecting information and details of any topic is quite difficult for a layman, who does not have so many resources to access the real source of information & we did this difficult task by the Grace of Almighty Allah & with the help of our teacher, Prof. Shahid Karamat. For the project of DBMS we choose Ehsan Chappal Store. The purpose of this project was to identify different entities and to define their different attributes. Moreover we were also required to define relationships among these entities. Along with some SQL queries. In ECS we found different entities including customers, suppliers, salesmen, manager materials sales etc. each of them were having different attributes. For eliminating bias, we consulted with the management to collect right information and entities. We also tried our best to describe right relationships of these entities. And the queries are also generated after full understanding.

IDENTIFICATION OF ENTITIES

Following are the entities we identify in Ehsan Chappal Store: 1. Customers 2. Salesmen 3. Managers 4. Bags 5. Shoes 6. Sales order 7. Purchase order 8. Materials 9. Suppliers 10.Sales

DEFINING THE ATTRIBUTES
Each entity has its own attributes. In the following, different entities have been explained with reference to their attributes: CUSTOMERS: • • • • • • Name NIC no. Order no. Contact no. Amount received Balance paid

SALESMEN: • • • • • • Name NIC no. Date of birth Address Contact no. Joining date

MANAGERS: • • • • • • • Name NIC no. Date of birth Address Contact no. Rank Seniority no.

BAGS:

• • • •

Colour Design no. Price Warranty Variety

SHOES:

• • • • •

Colour Design no. Price Size Warranty Variety

SALES ORDER: • • • • Order no. Design no. Units sold Price

PURCHASE ORDER: • Supplier no. • Order date

• • • • •

Delivery date Order no. Raw Material no. Quantity of materials Amount paid

MATERIALS: • • • • Type of material Raw material no. Opening balance Closing balance

SUPPLIERS: • • • • • Name Supplier no. NIC no. Address Contact no.

SALES: • Time period • Target sales • Actual sales

Relationships among Entities:

CUSTOMERS
Name
Fatima Ali Samana Amjad Anam Fatima Sara Baig Faiza Khan Aasma Idrees Hirra Atta

Orde N.I.C. no. r no.
352029950906-3 352025869485-3 352024587625-1 352024963578-2 352025653257-3 352024657123-9 352024563132-6 110 506 808 156 189 608 450

Contact no.
042-7416988 0333-4086852 0300-4057989 042-5076892 042-8451369 042-7464007 042-5057973

Amount Balance Receive Paid d
Rs. 1000 Rs. 600 Rs. 800 Rs. 500 Rs. 1000 Rs.1000 Rs. 300 Rs.301 Rs. 1 Rs.50 Rs. 25 Rs. 50 Rs. 450 Rs.25

Laiba Ali

Address
01-01-1990 12-07-1980 29-01-2003 16-03-2005 25-05-1995 30-03-1998 26-08-1980 03-09-1976 09-12-2002 19-11-1986

Contact no. Joining Date

Komal Alam

Aroob Fatima

Lahore255/C Gulshan-i-Ravi, 042-7596277 042-8950089 042-6121897

254/D Model Town, Lahore

352025468112-5 352024654319-5 352026412355-5

465/M Gulshan town ,LHR

598/R Railway road, Lahore 042-7596835 042-5073823 042-8613224 042-7416856 042-7468958 042-7560088 042-7568899

900

754

189

78/B Jaferia colony, Lahore

SALESMEN

46/B Iqbal Town, Lahore

0302-8980024

0347-4508939

0345-4896872

99/K Kacheri, LHR

896/G Iqbal Town, LHR

Rs. 450

Rs. 1200

Rs. 1500

566/F Anarkali, LHR.

Rs.300

Rs.75

Rs.25

650/H Choburgi, Lahore

Name Name
Aslam Abbas 35202-5689545-3 35202-7895842-3 35202-2935458-3 35202-1678987-3 Qamar Ali Hassan Ahmad Faisal Sheikh 01-11-1974 28-02-1965 01-05-1985 14-08-1986 05-12-1973 21-06-1979 35202-9874633-5 35202-8794656-5 Ashraf Anees Qurbaan Ali 35202-6546325-7 35202-4569989-7 06-09-1955 18-01-1957 23-09-1986 12-12-1968

MANAGERS

Addres s

23/G Iqbal Town, Lahore.

R ank

Account Manager

Amir Mehmood

N.I.C no.

Date of Birth

N.I.C no. Date of Birth
Osaja Ali John Fredrick M. Minhaal Farhan Hussain 35202-8976468-5 35202-8945612-3

3520201-11-1955 4685231-3

Contac t no.

03004302830

Seniority no.

145/b

258/F Defence, 02/A Gulshan-i-Ravi, Lahore. LHR

Javed Siddiqui

3520203-08-1962 8531425-9

03004661866

Branch Manager

140/b

Imran Ikram

3520203-05-1974 8264785-6

03004047939

ManagerAssistant ManagerAssistant

130/b

M. Ahmad

3520224-12-1976 4865324-5

12/H Model Town, Lahore.

03004242809

128/b

BAGS
Design no.
b-01 b-15

Colour
Black Brown

Price
Rs. 425 Rs.475

Warranty
6 months 6 month

Variety
Casual Casual

b-18 b-20 b-29 b-17 b-16 b-09 b-14

Pink Navy blue Gray Lemon Hazel White Sky blue

Rs. 950 Rs.700 Rs. 699 Rs. 550 Rs. 330 Rs.1125 Rs. 899

1 year 6 months 6months 6months 3 months 2 years 9 months

College bag Trendy Fancy Fancy Casual Trendy College bag

SHOES
Design no.
s-40 s-45

Colour
Pink Purple

Price
Rs. 780 Rs. 275

Size
7 8

Warranty
1 year 3 months

Variety
Casual Casual

s-50 s-55 s-60 s-65 s-75 s-80 s-85 s-90

Red Black Brown Lilac Violet Blue Green Hazel

Rs. 599 Rs. 899 Rs. 550 Rs. 999 Rs.1200 Rs. 750 Rs.300 Rs.1000

9 6 7 9 9 9 8 9

1 year 1 year 6 months 1 year 2 year 1 year 3 months 1 year

Fancy Fancy Casual Trendy Fancy Trendy Casual Casual

SALES ORDER

Order no.
110 506 808

Design no.
b-29 s-50 s-80

Units Sold
1 1 1

Price
Rs. 699 Rs. 599 Rs. 750

156 189 608 450 189 754 900

b-15 b-18 s-60 s-45 b-01 s-75 b-09

1 1 1 1 1 1 1

Rs. 475 Rs. 950 Rs. 550 Rs. 275 Rs. 425 Rs. 1200 Rs. 1125

PURCHASE ORDER
Raw Materia l no.
L-444 F-121 H-557

Order no.

Order Date

Delivery Date
16-01-2008 08-06-2008 17-06-2008

Supplie r no.
80 90 100

Quantity of Material
4 Meters 100 Dozens 12 Dozens

Amount Paid
Rs. 56,000 Rs. 75,000 Rs. 2,500

M-101 11-01-2008 M-201 03-06-2008 M-301 12-06-2008

M-401 01-01-2008 M-501 01-05-2008 M-601 16-05-2008 M-701 27-01-2008 M-801 28-02-2008

06-01-2008 06-05-2008 21-05-2008 02-02-2008 04-03-2008

P-989 R-875 C-513 J-675 Zi-78

110 120 130 140 150

35 Meters 8 Meters 15 Meters 30 Meters 25 Dozens

Rs. 10,000 Rs. 8,500 Rs. 20,000 Rs. 45,000 Rs. 12,000

MATERIALS
Type of Material
Leather Fancy Stones Metal Hooks

Raw Opening Balance Material no.
L-444 F-121 H-557 Rs. 500,000 Rs. 75,000 Rs. 10,000

Closing Balance
Rs. 380,000 Rs.50,000 Rs. 5,400

Parachute Rexene Cotton Jeans Zips

P-989 R-875 C-513 J-675 Zi-78

Rs. 35,000 Rs. 50,000 Rs. 25,000 Rs. 100,000 Rs. 18,000

Rs. 30,000 Rs.45,000 Rs. 15,000 Rs. 50,000 Rs. 7,000

SUPPLIERS
Name Supplie r no.
80

N.I.C no.

Address
Asian Factory, Gujranwala

Contact no.

Amjad Ali

35202-9864366-7

0333-8744556

Athar Qayyum

90

35202-6846566-1

Qayyum Factory, Sheikhopura M.R. Factory, Mianwali A.P.C. Factory, LHR Haseeb Factory, LHR Shah A.K. Qureshi Industries, Factory, Zips, LHR Gujarat LHR

0333-4641378

M. Rashid

100

35202-6784751-3

0333-8744554

Suleman Ali Haseeb-ulHasan

110

35202-6846782-6

0333-5623856

120

35202-4567460-3

0333-4696345

Anas Khan

130

35202-6842043-3

0333-7874554

Sajid Ahmad Haider Qureshi

140

35202-6541321-5

0333-5448741

150

35202-4854631-2

0333-4568926

SALES

Time Period
15th Aug – 15th Sept (2007) 15th Sept – 15th Oct (2007)

Target Sales
Rs. 1000,000 Rs. 1100,000

Actual Sales
Rs. 850,000 Rs. 1200,000

15th Oct – 15th Nov (2007) 15th Nov – 15th Dec (2007) 15th Dec – 15th Jan (2007-2008) 15th Jan – 15th Feb (2008) 15th Feb – 15th March (2008) 15th March – 15th April (2008) 15th April – 15th May (2008) 15th May – 15th Jun (2008)

Rs. 1200,000 Rs. 1150,000 Rs. 1300,000 Rs. 1250,000 Rs. 1350,000 Rs. 1400,000 Rs. 1200,000 Rs. 1200,000

Rs. 1150,000 Rs. 1175,000 Rs. 1000,000 Rs. 1265,000 Rs. 1466,000 Rs. 1174,000 Rs. 1355,000 Rs. 1499,000

RELATIONSHIP AMONG ENTITIES
Entities which are present in ECS have different relations among them. In the following we have described their relations with each other.
1. Relationship between SUPPLIERS and MATERIALS is one to

many because a supplier may supply many materials but each material is supplied by any number of suppliers.

2. Relationship between PURCHASE ORDER and MATERIALS is many to many because different materials can be bought through different purchase orders and many purchase orders can be used to bought many materials.
3. MANAGERS and PURCHASE ORDER are having a relation of

one to many because one manager can place many purchase orders but each purchase order is placed by only one manager.
4. MANAGERS and SALES ORDER are having a relation of one to

many because one manager can place many sales orders but each sales order is placed by only one manager. 5. Relationship between SALES ORDER and BAGS/SHOES is many to many because an order must request one or more products and the given product may be requested on one or more sales orders.
6. Relationship between SALES ORDER and CUSTOMERS is one

to one because one sales order is placed by only one customer and one customer places a single sales order.
7. CUSTOMERS and SALES are having many to many relations

because customers are directly related to sales. Sales are generated from one or more customers. 8. SALESMEN and CUSTOMERS are having one to one relation because in the same time one salesman provides its services to one customer and one customer is guided through only one salesman.

Simple ER Diagram

1 Managers
C an

M Purchase Order

M
C an

M Materials M

1
C an C an

C an

Sales Order

Bags or Shoes

M M 1 M Suppliers

1

C an

1 M Customers 1
C an

M Sales

C an

1 Salesmen

REDUNDANCY REDUCTION
To reduce the redundancy in the database, we have used primary and foreign keys along with composite keys so that the change in the primary key may also bring same change in the foreign key. In entities like CUSTOMERS, SALESMEN and MANAGERS NIC no. is the primary key. In BAGS and SHOES Design no. is the primary key

which is further used as foreign key in SALES ORDER, and ORDER no. In SALES ORDER is its primary key. Supplier no. is the primary key in the entity SUPPLIERS which is further used as foreign key in the PURCHASE ORDER. In MATERIALS raw material no. is used as a primary key. And the last entity which is SALES is having time period and actual sales as its composite key. This method helps us to reduce the redundancy for example if any change occurs in the supplier no. (Primary key) in SUPPLIERS entity, the values of the same column (foreign key) in the PURCHASE ORDER entity will be automatically changed.

SQL Queries
Query no. 1:
Select Opening Balance, Closing Balance From Materials

Answer: Opening Balance
Rs. 500,000 Rs. 75,000 Rs. 10,000 Rs. 35,000 Rs. 50,000 Rs. 25,000 Rs. 100,000 Rs. 18,000

Closing Balance
Rs. 380,000 Rs.50,000 Rs. 5,400 Rs. 30,000 Rs.45,000 Rs. 15,000 Rs. 50,000 Rs. 7,000

Query no. 2:
Select Time Period, Actual Sales From Sales

Answer: Time Period
15th Aug – 15th Sept (2007) 15th Sept – 15th Oct (2007) 15th Oct – 15th Nov (2007) 15th Nov – 15th Dec (2007) 15th Dec – 15th Jan (2007-2008) 15th Jan – 15th Feb (2008)

Actual Sales
Rs. 850,000 Rs. 1200,000 Rs. 1150,000 Rs. 1175,000 Rs. 1000,000 Rs. 1265,000

15th Feb – 15th March (2008) 15th March – 15th April (2008) 15th April – 15th May (2008) 15th May – 15th Jun (2008)

Rs. 1466,000 Rs. 1174,000 Rs. 1355,000 Rs. 1499,000

Query no. 3:
Select Time Period, Actual Sales From Sales Where Actual Sales > 1200,000

Answer: Time Period
15th Jan – 15th Feb (2008) 15th Feb – 15th March (2008) 15th April – 15th May (2008) 15th May – 15th Jun (2008)

Actual Sales
Rs. 1265,000 Rs. 1466,000 Rs. 1355,000 Rs. 1499,000

Query no. 4:
Select Type of Material, (Opening Balance – Closing Balance) From Materials

Answer: Type of Material
Leather Fancy Stones

No Name
Rs. 120,000 Rs. 25,000

Metal Hooks Parachute Rexene Cotton Jeans Zips

Rs. 4,600 Rs. 5,000 Rs. 5,000 Rs. 10,000 Rs. 50,000 Rs. 11,000

Query no. 5:
Select Time Period, Target Sales, Actual Sales From Sales Where Actual Sales > Target Sales

Answer: Time Period
15th Sept – 15th Oct (2007) 15th Nov – 15th Dec (2007) 15th Jan – 15th Feb (2008) 15th Feb – 15th March (2008) 15th April – 15th May (2008) 15th May – 15th Jun (2008)

Target Sales
Rs. 1100,000 Rs. 1150,000 Rs. 1250,000 Rs. 1350,000 Rs. 1200,000 Rs. 1200,000

Actual Sales
Rs. 1200,000 Rs. 1175,000 Rs. 1265,000 Rs. 1466,000 Rs. 1355,000 Rs. 1499,000

Query no. 6:
Select Name, N.I.C. no., Contact no. From Customers Where Order no. = 808

Answer:

Name
Anam Fatima

N.I.C. no.
352024587625-1

Contact no.
0300-4057989

Query no. 7:
Select Name, N.I.C. no., Address, Contact no. From Managers Where Rank = Assistant Manager

Answer: Name N.I.C no. Address
12/H Model 258/F Defence, Town, Lahore. Lahore.

Contact no.

Imran Ikram

35202-8264785-6

0300-4047939

M. Ahmad

35202-4865324-5

0300-4242809

Query no. 8:
Select Name, N.I.C. no., Contact no. From Salesmen Where Joining date > 01-01-1990

Answer: Name
Hassan Ahmad Faisal Sheikh Farhan Hussain Osaja Ali Ashraf Anees

N.I.C no.
35202-2935458-3 35202-1678987-3 35202-8976468-5 35202-8945612-3 35202-6546325-7

Contact no.
042-6121897 042-7596835 042-5073823 042-8613224 042-7560088

Query no. 9:
Select Design no., Colour, Price, Variety From Bags Where Price between Rs. 500 and Rs. 1,000

Answer: Design no.
b-18 b-20 b-29 b-17 b-14

Colour
Pink Navy blue Gray Lemon Sky blue

Price
Rs. 950 Rs.700 Rs. 699 Rs. 550 Rs. 899

Variety
College bag Trendy Fancy Fancy College bag

Query no. 10:
Select Design no., Colour, Price, Size From Shoes Where Price < Rs. 800

Answer: Design no. Colour Price Size

s-40 s-45 s-50 s-60 s-80 s-85

Pink Purple Red Brown Blue Green

Rs. 780 Rs. 275 Rs. 599 Rs. 550 Rs. 750 Rs.300

7 8 9 7 9 8

Query no. 11:
Select Name, N.I.C. no., Contact no. From Suppliers Where Supplier no. < = 110

Answer: Name
Amjad Ali Athar Qayyum M. Rashid Suleman Ali

N.I.C no.
35202-9864366-7 35202-6846566-1 35202-6784751-3 35202-6846782-6

Contact no.
0333-8744556 0333-4641378 0333-8744554 0333-5623856

Query no. 12:
Select Name, N.I.C. no., Contact no. From Customers Order by Name asc

Answer:

Name
Aasma Idrees Anam Fatima Aroob Fatima Faiza Khan Fatima Ali Hirra Atta Komal Alam Laiba Ali Samana Amjad Sara Baig

N.I.C. no.
35202-4657123-9 35202-4587625-1 35202-5468112-5 35202-5653257-3 35202-9950906-3 35202-4563132-6 35202-4654319-5 35202-6412355-5 35202-5869485-3 35202-4963578-2

Contact no.
042-7464007 0300-4057989 0345-4896872 042-8451369 042-7416988 042-5057973 0347-4508939 0302-8980024 0333-4086852 042-5076892

Query no. 13:
Select Order no., Design no. From Sales Orders Where Price > Rs. 600

Answer: Order no.
110 808 189 754 900

Design no.
b-29 s-80 b-18 s-75 b-09

Query no. 14:
Select Order no., Raw Material no., Supplier no., Amount Paid From Purchase Orders

Answer: Order no.
M-101 M-201 M-301 M-401 M-501 M-601 M-701 M-801

Raw Material no.
L-444 F-121 H-557 P-989 R-875 C-513 J-675 Zi-78

Supplier no.
80 90 100 110 120 130 140 150

Amount Paid
Rs. 56,000 Rs. 75,000 Rs. 2,500 Rs. 10,000 Rs. 8,500 Rs. 20,000 Rs. 45,000 Rs. 12,000

Query no. 15:
Select Time Period, (Actual Sales – Target Sales) From Sales

Answer: Time Period
15th Aug – 15th Sept (2007) 15th Sept – 15th Oct (2007) 15th Oct – 15th Nov (2007) 15th Nov – 15th Dec (2007) 15th Dec – 15th Jan (2007-2008)

No Name
(Rs. 150,000) Rs. 100,000 (Rs. 50,000) Rs. 25,000 (Rs. 300,000)

15th Jan – 15th Feb (2008) 15th Feb – 15th March (2008) 15th March – 15th April (2008) 15th April – 15th May (2008) 15th May – 15th Jun (2008)

Rs. 15,000 Rs. 116,000 (Rs. 226,000) Rs. 155,000 Rs. 299,000