0% found this document useful (0 votes)
18 views

database project group 5

The document outlines a project for developing a database system for the Sunshine Supermarket, detailing the objectives, scope, methodology, and design elements including an ER diagram. It aims to replace the existing manual data handling system to enhance efficiency, reduce redundancy, and improve transaction processes. The project includes various functionalities such as employee account management, inventory updates, and billing calculations.

Uploaded by

setemelese91
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

database project group 5

The document outlines a project for developing a database system for the Sunshine Supermarket, detailing the objectives, scope, methodology, and design elements including an ER diagram. It aims to replace the existing manual data handling system to enhance efficiency, reduce redundancy, and improve transaction processes. The project includes various functionalities such as employee account management, inventory updates, and billing calculations.

Uploaded by

setemelese91
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

WACHEMO UNIVERSITY COLLAGE OF ENGINEERING AND TECHNOLOGY DEPARTEMENT OF SOFTWARE

PROJECT TITLE: DATABASE FOR SUPER MARKET

SECTION A

GROUP NAME ID NUMBER

1. TESFAYE ABERA……..…..1501343

2. SISAY KEBEDE……………1501279

3. TSEDEKE WONDIMU..…1510032
4. SHIMELIS HAILU…..…….1501271

5. SETELIGN MELESE………1501262

. SUMMITED DATE 10/09/2016E.C

SUMMITED TO
MS.FOZIA

Contents page

ACKNOWLEDGEMENT 1

1
1 Introduction 2

2 Objective 3

2.1 General objective 4

2.2 Specific objective 5

3 Scope of the project 5

4 Methodology 5

5 Activities in the Existing System 5

6 Design 6

7 ER-Diagram with their description 7

7.1 ER - diagram 8

7.2 Description of ER-diagram 9

7.3 Cardinality of a Relationship 9

7.4 Mapping ER-diagram to relation 15

8 Implementation 18

ACKNOWLEDGEMENT

Firstly we would like to express our priceless gratitude to our instructor Md. fozia for his willingness to
giving us this chance to work on this project because this project made us understand more about this
course. And also for all peoples who contribute in this project we would like to say thank you.

1 Introduction

The sun shine super market gives fundamental uses to the society .in the previous time it works based on
manual approach of data handling. This makes very tidies to manipulate the data.so we tried to change this
system to database approach ,in order to reduce data redundancy and to store our file in safe and secured
place by locating database.

2
2.Objective

2.1 General objective

The main objective of our project is to develop a database system for sun shine super market.

2.2 Specific objective

Proposing the new system

Designing the proposal conceptually logically and physically.

To reviewing the current database and knowing the problem

To study each activity involved in the database

To design and implement the database

To deliver the system to the shop

3 Scope of the project

This project focus on only in development a system for sun shine supermarket with many advanced futures
that reduces time, effort and improve the way of money transaction for the supermarket.

In our project we include the following points

The system allows to create an account for new employees

Inserting a new record in to a database.

Deleting items if they are expired

updating items information if changes are occur

Enhancing database security and concurrent access to the database.

Calculate the bill.

Store how many products are sold.

Store products and their prices and with other information.

Set the rates of taxes and commission on the products.

the design of the database

ER diagram with their describtion

3
implementation of the project

fundamental concept

4 Methodology

The methods that will be employed are:

we model the entities and other actors of the system using E-R modeling

Relational model must be used and we have selected the SQL server 2008 software.

The language we will use is SQL (structured query language) because it has so many features and easy to
understand.

Players in the Existing System

The player or actor of the existing system of the supermarket is

Customer :is the important person who purchase item from the supermarket

Cashier: is the person who registers the item and give bill to the customer.

: play in the billing system of the current system.

Employee: a person who sells item to the customer

Manager: manages the overall transaction and the employee and

Supplier: a person who supply item to the super market

5.Major Functions/Activities in the Existing System

Process: the overall process that takes place in the supermarket concerning the item are:

The cashier registers item.

The customer purchase item

customer pay bill for registration

customer go to find item

employee in the supermarket assist the customer

Customer pay for the item and for vat.

The customer takes the item and gives to the cashier

4
the cashier checks the item is expired or not and checks the item is completed or not.

Supplier supply item to the supermarket .

Manager manages the employee and cashier

Manager requests the supplier to supply item

Employee Send sold item to the cashier

Employee Show item location for the customer

Cashier Print bill to the customer

Cashier Register item information

Cashier Send report to the manager

Output: The outputs of the existing system are:

bill papers.

Pay for the cashier.

Get Satisfaction by supplying goods to the customer.

6.Design

7.E-Diagram with their description

7.1ER diagram

5
7.2 Description of the entity

Customer: Have an attributes

 Name:- it is composite attribute which have


o First name
o Last name
 Customer id: it is the primary key
 Sex
 Age :it is derived attribute calculate as( current date-birth date)
 Phone number :it is multi valued attribute
 DOB
- Customer – has relationship with employee give service to the customer that he/she want to buy
- The cashier print bill and give to customer .
- Customer – has relationship with item that is customer buys item
-

6
employee: - Have an attributes

 Name:- it is composite attribute which have


o First name
o Last name
 employee id: it is the primary key
 Sex
 Age :it is derived attribute calculate as( current date-birth date)
 Phone number :it is multi valued attribute
 DOB
- This entity has relationship with customer and manager.
- employee has relationship with the item entity with sells
- employee search item that is requested by the customer

Manager: - An other entity in ER

 Name:- it is composite attribute which have


o First name
o Last name
 Manager id: it is the primary key
 Sex
 Age :it is derived attribute calculate as( current date-birth date)
 address :it is composite attribute which have
o phone no it is multi valued attribute
o email it is also a multi valued attribute
 DOB
- Manager requests the supplier to supply item
- the manager manages the employee and cashier

Item :is another entity in ER

- It has an attribute of item name , item code, item type, quantity ,state ,exp_date,
- And a multivalued attribute of price that is cost price and sell price

Supplier : - Another entity in ER

 Name:- it is composite attribute which have


o First name
o Last name
 Supplier id: it is the primary key
 Age :it is derived attribute calculate as( current-birth date)
 address :it is composite attribute which have
o phone no it is multi valued attribute
o email it is also a multi valued attribute
o city

7
 DOB
- It has a relation with managers
- It has supply item in a supplied date

7.2 Cardinality of a Relationship

One-to-one

manager with cashier:-one manager manages one cashier in the supermarket

One-to-many

Manager with employee:-one manager manages one or more employee in the super market

Manager with supplier:-one manager requests one or more supplier

Cashier with item: one cashier register many item

Cashier: one cashier can print bill for one or more customer

Many-to-many

Customer with item: this means many customers buy one or more items or one item is bought by one or more
customer

Employee with item:this means many employees sell one or more items or one item is sold by one or more
employee

Employee with customer: this means many employee give service to one or more customer

7.3 Mapping ER diagram to relational database

There will be Manager table with Man_id, dob, age, and sex being the columns.

The name attribute will be a new table as it is

The email attribute will be a new table as it is

The phone_no attribute will be a new table as it is

multi-valued

Manager

Man_id Dob age sex fname Lname

8
Man_email

Man_id email

Man_Phone_number

Man_id Phone_no

Customer

Cust_i Age sex dob fname Lname


d

Cust_Phone_number

Cust_id Phone_no

Employee

Emp_id Dob Age Sex Fname Lname

Emp_Phone_number

Cust_id Phone_no

Cashier

Cash_id Dob age Sex fname lname

Cash_Phone_number

Cust_id Phone_no

Managed

man_id Emp_id Cash_id Income soldItem

9
Item

Item_code Item_name Item_type State Quantity Exp- Costprice Sellpric


date e

suplier

sup_id Dob Age city fname lname

Phone_number

sup_id Phone_no

email

sup_id email

Supplies

Sup_id Item_code Supply_date

Buys

cust_id Itemcode Buys Itequantity


date

Sells item
emp_id Item_code Sell date

Give_service print bill

10
Emp_id Cust_id cust_id emp_id Bill_no

Man_id Sup_id

database schema

Manager

Man_id Fname Lname dob Age Sex

Phon number

man_id Phon_no

Email

Man_id email

Managed

Man_id Emp_id Cash_id Income soldItem

Customer

Cust_id Fname Lname Age Sex Dob


Phon number

Cust_id Phon _no

Print_bill

11
cust_id Cas_id Bill_no

cashier

cash_id Fname Lname Dob Age Sex

Phone num

Cash_id Phon_no

Register_new item

Item_code Cash_id Bill_no

employee

Emp_id Fname Lname Dob Age Sex

Phone number

Emp_id Phone_no

Give service

Emp_id Cust_id

Sells ite

Emp_id Item_code

Item

12
Item_code Item_name Item_type Sell_price Cost_price State Quantity Exp-date

suplier

sup_id Fname Lname dob Age city

Phone_no

Sup_id Phone_no

Email

Sup_id Email

Supplies
Sup_id Item_code Supply_date

buys

cust_id Item_code

request

Man_id Sup_id

8. Implementation

create database supermarkate


use supermarkate
create table custumer
(
Cust_id varchar(20)not null primary key,
Fname varchar(20),
Lname varchar(20),

13
Sex char(5),
Constraint ck_sx check (sex in('f','m','female','male')),
Dob date,
Age int,
Phone_no varchar(13)
)
-----------------employee tabee----------------

Create table employee


(
Emp_id varchar(20)not null primary key,
Fname varchar(20),
Lname varchar(20),
Sex char(5),
Constraint ck1_sx check (sex in('f','m','female','male')),
Dob date,
Age int,
Phone_no varchar(13))

-----------------manager table--
Create table manager
(
Man_id varchar(20)not null primary key,
Fname varchar(20),
Lname varchar(20),
Sex varchar(5),
Dob date,
Age int,
Phone_no varchar(13),
Email varchar(13)
)
-----------------cashier table----------------
Create table cashier
(

cash_id varchar(20)not null primary key,


Fname varchar(20),
Lname varchar(20),
Dob date,
Age int,
Sex varchar(5),
Phone_no varchar(13),
Email varchar(13)
)
-----------------item table----------------
Create table Item
(
Item_code varchar(20)not null primary key,
Item_name varchar(20),
Item_type varchar(20),
Quantity int,

14
Cost_price float,
Sell_price float,
Exp_date date,
States varchar(20),
)
-----------------suplier table----------------

create table suplier


(
sup_id varchar(20)not null primary key,
Fname varchar(20),
Lname varchar(20),
Sex varchar(5),
Dob date,
Age int,
Phone_no varchar(13),
Email varchar(13),
city varchar(23)
)
-----------------give_bill table----------------
Create table gives_bill
(
Gcust_id varchar(20)not null foreign key references custumer(cust_id),
Gcash_id varchar(20)not null foreign key references cashier(cash_id)
)
-----------------give service table----------------
Create table givem_service
(
cust_id varchar(20)not null foreign key references custumer(cust_id),
emp_id varchar(20)not null foreign key references employee(emp_id)
)
-----------------buys table----------------

create table buys


(
bcust_id varchar(20)not null foreign key references custumer(cust_id),
bitem_code varchar(20)not null foreign key references Item(Item_code),
bquantity int,
bdate date
)
-----------------sells table----------------
create table sells
(
Semp_id varchar(20)not null foreign key references employee(emp_id),
SItem_code varchar(20)not null foreign key references Item(Item_code),
squantity int,
selldate date
)
-----------------managed table----------------

create table managed

15
(
Mman_id varchar(20)not null foreign key references manager(man_id),
Memp_id varchar(20)not null foreign key references employee(emp_id),
Mcash_id varchar(20)not null foreign key references cashier(cash_id),
income money,
sold_item int
)
-----------------request table----------------
create table request
(
rman_id varchar(20)not null foreign key references manager(man_id),
rsup_id varchar(20)not null foreign key references suplier(sup_id),
)
-----------------supply table----------------
create table supply
(
suitem_code varchar(20)not null foreign key references Item(Item_code),
susup_id varchar(20)not null foreign key references suplier(sup_id),
supply_date date
)
-----------------register table----------------
Create table rigister
(
rrcash_id varchar(20)not null foreign key references cashier(cash_id),
rritem_code varchar(20)not null foreign key references Item(Item_code)
)
-------------------------populate data----------------------------
------customer-----
insert into custumer
values('cu001','Dagim','Bekele','m','12/04/1994',21,'+250936587441')
insert into custumer
values('cu002','ale','belete','m','12/04/1994',21,'+25196588485')
insert into custumer
values('cu003','bete','wasie','f','12/04/1995',20,'+251936458752')
insert into custumer
values('cu004','wale','beke','m','12/04/1994',21,'+251956842369')
insert into custumer
values('cu005','leli','wale','m','12/04/2004',11,'+251945698712')
insert into custumer
values('cu006','mesi','adhenafi','f','12/04/1970',47,'+25111112354')
insert into custumer
values('cu007','belete','mele','m','12/04/1965',52,'+25111456589')
insert into custumer
values('cu009','ayalew','welelaw','m','12/04/1970',47,'+25111661123')
insert into custumer
values('cu008','betelehem','medihin','f','12/04/1994',21,'+251918969791')
insert into custumer
values('cu0010','belachew','belete','m','12/04/1994',21,'+251918969763')

select *from custumer


select cust_id,sex,fname,phone_no from custumer

16
select fname,lname from custumer where Sex='f'
select fname,lname from custumer where Sex='m'
select year(Dob)as dob,year((select getdate()))asnow,year((select
getdate()))-year(dob)as age from custumer
-----------casher----------

insert into cashier


values('cas11','Abebe','Alemu','12/01/2000',45,'m','0912456334','[email protected]
il')
select *from cashier

----------gives bill---------

insert into gives_bill values('cu001','cas11')

insert into gives_bill values('cu001','cas11')


select *from gives_bill

------employee-----
insert into employee
values('emp001','betelehem','medihin','f','12/04/1994',21,'+251918969791'
)
insert into employee
values('emp002','belachew','belete','m','12/04/1994',21,'+251918969763')
----------------------employee-----------------------------
select*from employee
select emp_id,fname,sex,dob,phone_no from employee
select dob,age from employee
select year(Dob)as dob,year((select getdate()))asnow,year((select
getdate()))-year(dob)as age from employee

------manager-----
insert into manager
values('man002','kedus','fekadu','m','12/04/1970',23,'+251911114521','man
@gmal.com')
------suplier-----
insert into suplier
values('sup002','balw','yibe','m','12/04/1970',23,'+251911114521','own@gm
al.com','gonder')
insert into suplier
values('sup001','balw','yibe','m','12/04/1970',23,'+251911114521','man@gm
al.com','adis abebe')
--------------------------manager---------------------
select*from manager
select man_id,fname,Sex from manager
select man_id,phone_no,email from manager
select man_id,dob from manager
select dob,age from manager
select year(Dob)as dob,year((select getdate()))asnow,year((select
getdate()))-year(dob)as age from suplier
----------------------suplier-----------------------------

17
select*from suplier
select sup_id,fname,Sex,city from suplier
select sup_id,phone_no,email from suplier
select sup_id,dob from suplier
select dob,age from suplier
select year(Dob)as dob,year((select getdate()))asnow,year((select
getdate()))-year(dob)as age from suplier

------item-----
insert into Item
values('it002','pepsi','food',23,23.4,44.8,'12/04/2016','liquid')
insert into Item
values('it001','bread','food',23,23.9,44.4,'11/04/2016','solid')
insert into Item
values('it0078','checolet','food',23,2.7,4.4,'12/04/2016','solid')
insert into Item
values('it006','milk','food',23,2.3,4.9,'2/01/2019','liquid')
insert into Item
values('it009','bread','food',23,8.3,44,'12/06/2016','solid')
----------------------item-----------------------------
select*from Item
select Item_code,Item_name,Item_type,Sattus from Item where
Item_type='food'and Sattus='solid'
select Item_code,Item_name,Item_type,Sattus from Item where
Item_type='deteregent'and Sattus='gas'
select Item_code,Item_name,Item_type,Sattus from Item where
Item_type='cosmotics'and Sattus='liquid'
select Item_code,Item_name,exp_date from Item
select*from Item where Quantity<10
select Item_name from Item where quantity>10 and Exp_date<(select
GETDATE())
select Item_code,cost_price from Item
select Item_code,Item_name,Cost_price*quantity as
total_price_of_each_item from Item
select Item_code,Item_name,sell_price*quantity as
total_price_of_each_item from Item

--------cashier----------
insert into cashier
values('cash001','mekedes','medihin','12/04/1970',23,'f','+251911114521',
'[email protected]')
------give_service-----
insert into givem_service values('cu001','emp001')
insert into givem_service values('cu002','emp001')
insert into givem_service values('cu004','emp002')
insert into givem_service values('cu002','emp001')
insert into givem_service values('cu001','emp002')
------sells-----
insert into sells values('emp001','it001',4,(select GETDATE()))
insert into sells values('emp002','it002',3,(select GETDATE()))
insert into sells values('emp001','it001',3,(select GETDATE()))

18
select *from sells
------buys-----
insert into buys values('cu001','it001',6,(select GETDATE()))
insert into buys values('cu001','it002',6,(select GETDATE()))
insert into buys values('cu001','it003',1,(select GETDATE()))
insert into buys values('cu002','it001',5,(select GETDATE()))
insert into buys values('cu002','it002',3,(select GETDATE()))
select*from buys

------managed-----
insert into managed values('man002','emp001','cash001','200',4)
------supply-----
insert into supply values('it002','sup001','12/12/2006')
insert into supply values('it002','sup001','12/12/2006')
------request-----
insert into request values('man002','sup002')
------register-----
insert into rigister values('cash001','it003')
insert into rigister values('cash001','it002')
insert into rigister values('cash001','it003')
insert into rigister values('cash001','it004')
----------------------give_service-----------------------------
select *from givem_service
----------------------buys-----------------------------
select *from buys
----------------------sells-----------------------------
select *from sells
----------------------managed-----------------------------
select *from managed
----------------------supply-----------------------------
select *from supply
----------------------rigister-----------------------------
select *from rigister
----------------------request-----------------------------
select *from request
----------------------give_bill-----------------------------
select *from givel_bill

-------------------------item with customer----------------------------


select cust_id ,Item_name from Item,custumer ,buys where
Item_code=bitem_code and Cust_id=bcust_id
select cust_id,fname,item_name,Item_type
,cost_price,bquantity,cost_price*quantity as
total_price,cost_price*bquantity*0.15 as vat,(cost_price*bquantity)-
(cost_price*bquantity*0.15) total_with_vat from item,custumer,buys where
Item_code=bitem_code and Cust_id=bcust_id
select fname,Item_name from item,custumer,buys where Item_code=bitem_code
and Cust_id=bcust_id and Age<30 and item_type='cosmotics'

-------------------------item with employee----------------------------


select *from sells

19
select *from Item
select Item_name,Cost_price,selldate,squantity from Item,sells s,employee
where Item_code=SItem_code and emp_id=Semp_id
select fname,count(Item_code)as total_item from Item,custumer,buys where
Item_code=bitem_code and cust_id=bcust_id and item_type='food'group by
fname
select fname,item_name from item,custumer,buys where Item_code=bitem_code
and cust_id=bcust_id and Item_type='food'
-------------------------employee with
manager----------------------------
select count(Item_code)as sold_item from Item,buys ,custumer where
Item_code=bitem_code and cust_id=bcust_id
select SUM(cost_price*bquantity)as total_income from Item,buys ,custumer
where Item_code=bitem_code and cust_id=bcust_id

-----------------------------------ageregate
function-----------------------
select count(cust_id)as total_number_of_custumer from custumer,buys where
bcust_id=cust_id
SELECT COUNT(emp_id)as employee_no FROM employee
select COUNT(Item_code)from Item where Sattus='solid'
select COUNT(Item_code)from Item where Sattus='liquid'
select COUNT(Item_code)from Item where Sattus='gas'
select SUM(quantity)from Item
select AVG(cost_price)from Item
select fname,COUNT(item_code)from item,custumer,buys where
Item_code=bitem_code and Cust_id=bcust_id group by Fname
select cust_id,fname,lname,item_code,sell_price,quantity from
custumer,item,buys where Item_code=bitem_code and Cust_id=bcust_id
select*,(cost_price*quantity)as totalcost,(sell_price*quantity)as
totalsell ,(cost_price*quantity)-(sell_price*quantity)as profit from
Item
select sum((cost_price*quantity)-(sell_price*quantity))as total_profit
from Item
select COUNT(cust_id)as total_customer_no from custumer
select COUNT(*)as number_of_item from Item
select sum(cost_price*quantity) total_cost,sum(sell_price*quantity)as
total_sell,sum(cost_price*quantity)-sum(sell_price*quantity)as total_cash
from Item

select bdate,fname,Item_name,Cost_price,bquantity,
(Cost_price*bquantity)as total,(Cost_price*bquantity*0.1)as vat,
(Cost_price*bquantity)+(Cost_price*bquantity*0.1)as total_cost from
custumer,Item,buys where Item_code=bitem_code and Cust_id=bcust_id

----------------------------------update
customer---------------------------------
update custumer set Age=year((select getdate()))-year(dob)
update custumer set Fname='bekalu'where Cust_id='cu004'
update custumer set Phone_no='0935012369'where Cust_id='cu002'

20
----------------------------------update
employee---------------------------------
update employee set Age=year((select getdate()))-year(dob)
update employee set Fname='bekalu'where Emp_id='emp001'
update employee set Phone_no='09113526894'where emp_id='emp002'

select*from employee
----------------------------------update
manager---------------------------------
update manager set Age=year((select getdate()))-year(dob)
update manager set Fname='mesfin'where Man_id='man002'
update manager set Phone_no='0911121513'where man_id='man002'
update manager set Email='[email protected]'where man_id='man002'
select*from manager

----------------------------------update
cashier---------------------------------
update cashier set Age=year((select getdate()))-year(dob)
update cashier set Fname='kidist'where cash_id='cash001'
update cashier set Phone_no='0965845695'where cash_id='cash001'

select*from cashier
----------------------------------update
item---------------------------------
update Item set Item_name='mastica'where Item_name='gum'
update Item set shelf_no=3 where Item_code='it002'
update Item set cost_price=sell_price+5 where Cost_price<Sell_price

select*from Item
----------------------------------update
suplier---------------------------------
update suplier set Fname='ermias'where sup_id='sup001'
update suplier set Age=year((select getdate()))-year(dob)
update suplier set city ='bahirdar'where city='adis abebe'
update suplier set Phone_no='0911111135'where sup_id='sup002'

select*from suplier
-------------------------------
delete-------------------------------------------------------
-------------------delete item---------------------------
select *from Item
delete from Item where Exp_date<(select GETDATE())
delete from item where Quantity=0
------------------delete customer------------------------
delete from custumer where age<=21
select*from custumer
------------------delete employee-----------------
delete from employee where Emp_id='emp002'
select *from employee

21
22

You might also like