Downlaod File - Prince Mohammad Bin Fahd University

Prince Mohammed Bin Fahd University
Database Design GEIT 3341
Ms. Wesal Mohamed Ali
Sec: 201
DATABASE FINAL PROJECT
Designing a Database of a Coffee Shop
Group members:
Dana Al-Majid – 200900731
Marwa Al-Homoud – 200900997
Major: Information Technology
Submission day: Saturday, December 29, 2012
Designing a Database of a Coffee Shop
Detail Description:
In database design course we need to create an entity relationship on database
schema design about coffee shop called “DEEMEE”. The following data model
is designed to hold information relating to coffee shop schema. In this project we
will define many important definitions about basic ER modeling concepts in
order to understand them as well as to understand our project correctly
The coffee shop is organized into members. Each member has a unique id, also
contains first name, Last name, phone number, birth date and addresses a
particular member who belongs to the branches. We keep track of the start date of
when he starts managing the branches. Branches have several of address
locations. Each branch controls a number of Sales. Between the two entity of
member and branches there is total participation on them. Each sale has a unique
sales id, mugs, price, quantity, food, members, drinks and member id which is
foreign key. In Sales entity price is multivalued attributes and most of the entity
are simple attributes. Each entity has an attribute. Another entity that we created
in this schema is Customers which contain the following attributes Customer’s id
and Bill (time, price). There is composite attributes in the customers entity. A
composite attributes is the attribute may be composed of several components (can
be divided into smaller subparts). Attributes are properties used to describe an
entity. For example we have Order entity which have composite attributes called
Payment Method “PM” which contain (cash, credit card), order id and customer’s
id.
Designing a Database of a Coffee Shop
There is Cordiant ratio is Relationship types usually have certain constraints that
limit the possible combinations of entitles that may participate in the
corresponding relationship set. Which is one-to-many, It can be explained that
each branch have a relationship CONTAINS for many customer's. As the same
between customers and Order, the relationship called COFFEE_ TYPE. And
between Branches and Members there's Cordiant ratio one-to-many called
BELONG TO that’s mean each branch has many of members who can work
there. Between members and sales which is shows one-to-many coordinate
ration, the relationship called WORKS_ON that’s mean one member who is
rresponsible for sales, payment and purchase may sale many of food and drinks
so there is no limited number of sales to the customers. Between Branches and
sales is one-to-many, the relationship called CONTROLS. Cardinality ratio (of
a binary relationship):
(1:1), (1:N), (N:1), or (M:N) Shown by placing appropriate numbers on the
relationship edges.
Another thing between these entities is that they have Participation
constraint. Participation constraint means (on each participating entity
type): total (called existence dependency) or partial. The Total is shown
with double line but the partial with single line.
Target and requirements specifications:
Our target is to design a database for a coffee shop. This coffee shop
has several branches. Each branch has a unique id, number phone, address
location and particular members. Each member will have to record their
information which is their ids, names, phone numbers, birth days and addresses.
Designing a Database of a Coffee Shop
However, the sales are the same in all the branches of the coffee shop. Each sale
has its unique id, price, quantity, Mugs, food, members and drinks. In addition,
customers can order as much as they want from our sales, they can pay with
credit card or cash. The bill which the customers should get must include their
ids, time, price and date.
Entities and attributes:
Entities
Attributes
Branches
Branch Id, Phone, address location,
members, short name and Sales Id.
Sale
Mugs, price, quantity, food, members,
drinks and sales id
Member
Member id, First name, Last name, phone
number, birth date and addresses
Customers
Customer’s id and Bill (time, price).
Order
Payment method (cash, credit card), order
id and customer’s id.
Designing a Database of a Coffee Shop
Cardinality relationships between entities:
 BELONG_TO (between Branches and Members, 1:N)
 CONTAIN (between Branches and Customers, 1:N)
 WORKS_ON (between Members and Sales, 1:N)
 COFFEE_TYPE (between Customers and Order, 1:N)
 CONTROLS (between Branches and Sales, 1:N)
Designing a Database of a Coffee Shop
The Design of an ER Schema:
Sales_id
1
N
CONTAIN
Branches
Customers
Short_Name
1
Bill
Belong_To
Bill_time
N
Custo_id
Bill_date
Bill_price
Birth_date
1
Mem_id
1
CONTROLS
Members
Last_name
N
COFFEE_TYPE
First_Name
N
Custo_id
Address
Phone_Number
Order
1
Payment
methods = PM
WORKS_ON
N
Mugs
Quantity
Sales
Food
Sales_id
Mem_id
Price
Cash
Credit card
Order _id
Designing a Database of a Coffee Shop
Generalization Design:
Mem_id
Phone_Number
These are
Subtypes
Birth_date
Address
First_Name
Members is
Supertype
Members
Last_name
d
Completed a Bachelor's
Degree with No Work
Experience
Still a Student
“Part Time Job”
Completed a Bachelor's
Degree with Work
Experience
Detaille Description:
The above diagram shows generalization with disjoint subtypes. Generalization
is the reverse of the specialization process. A Superclass or subclass represents a
collection (or set or grouping) of entities. As shown in our design the arrow
pointing to the generalized Superclass represents a generalization, the arrows
pointing to the specialized Subclasses represent a specialization. Similarities are
generalized to a super-class entity. Differences are specialized to a subclass
entity.
Designing a Database of a Coffee Shop
Each of these Subgroupings is a subset of MEMBER entity. Each is called a
Subclass of MEMBER. MEMBER is the Superclass for each of these
subclasses.
These are called Superclass/Subclass relationships:
 MEMBER/Completed a Bachelor's Degree with No Work Experience.
 MEMBER/Still a Student “Part Time Job”.
 MEMBER /Completed a Bachelor's Degree with Work Experience.
These are also called IS-A relationships:
 Who completed a Bachelor’s Degree with No Work Experience is a
MEMBER,
 Who Still a Student “Part Time Job is a MEMBER.
 Who completed a Bachelor's Degree with Work Experience is a MEMBER.
Designing a Database of a Coffee Shop
The Screen shot
Table 1: Member4
Designing a Database of a Coffee Shop
Table 2: Branches4
Designing a Database of a Coffee Shop
Table 3: Sales4
Designing a Database of a Coffee Shop
Table 4: Customers2
Designing a Database of a Coffee Shop
Table 5: Order2
Designing a Database of a Coffee Shop
THE VALUES:
Table1:
Designing a Database of a Coffee Shop
Table 2:
Designing a Database of a Coffee Shop
Table 3:
Designing a Database of a Coffee Shop
Table 4:
Designing a Database of a Coffee Shop
Table 5:
Designing a Database of a Coffee Shop
SELECT Command:
Table 1, member4:
Table 2, Branches4:
Designing a Database of a Coffee Shop
Table 3, Sales4:
Table 4, Customers2:
Designing a Database of a Coffee Shop
Table 5, Order2: