0% found this document useful (0 votes)
10 views15 pages

DB-Lec7

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

DB-Lec7

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

ERD Example

Example
1:
Consider a university database for the scheduling of classrooms for -final
exams. This database could be modeled as the single entity set exam,
with attributes course-name, sectionnumber, room-number, and time.
Alternatively, one or more additional entity sets could be defined, along
with relationship sets to replace some of the attributes of the exam entity
set, as
 Course with attributes name, department, and c-number
 Section with attributes s-number and enrollment, and dependent on
course
 Room with attributes r-number, capacity, and building
Show an E-R diagram illustrating the use of all three additional entity
sets listed
Example 2
A database used in an order-entry system is to contain information about customers,
items, and orders. The following information is to be included.
- For each customer:
Customer number (unique)
Valid “ship to” addresses (several per customer)
Balance
Credit limit
Discount

- For each
order:
Heading
information:
customer
number,
“ship-to”
address, date
of order.
Detail lines
(several per
order), each
giving item
number,
quantity
ordered
Example 2. (cont.) An Order-Entry System

- First, only decide entity types and relationship types.

Customer
1

EX

m
m m
Order Item

m
Warehouse

ER Model 48
Example 2. (cont.) An Order-Entry System
- then add attributes of entity types and relationship types.
C# Address Balance

Credit Limit

Customer
Discount
1

EX Description
Item#

m
m m
Order Item

m QOH
Order#
Date QTY
SDL SDL – Stock Dangerous Level
m
Ship-to- QTY
Outstanding Warehouse
Address Address

P#
Constraints:
Between Address & Ship-to-Address
ER Model 49
Example 2. Recall the supplier-part-project database - SPJ

Sname Status

S#
Supplier
m City

SPJ

m m
Qty
Part Project
Weight
P# Pname Color J# Jname

ER Model 50
Example 3.

UPS prides itself on having up-to-date information on the processing and current
location of each shipped item. To do this, UPS relies on a company-wide
information system. Shipped items are the heart of the UPS product tracking
information system. Shipped items can be characterized by item number (unique),
weight, dimensions, insurance amount, destination, and final delivery date. Shipped
items are received into the UPS system at a single retail center. Retail centers are
characterized by their type, uniqueID, and address. Shipped items make their way to
their destination via one or more standard UPS transportation events (i.e., flights,
truck deliveries). These transportation events are characterized by a unique
scheduleNumber, a type (e.g, flight, truck), and a deliveryRoute. Please create an
Entity Relationship diagram that captures this information about the UPS system.
Be certain to indicate identifiers and cardinality constraints.
Example 4.
For each department the database contains a department number (unique), a budget value, and
the department manager’s employee number (unique). For each department the database also
contains information about all employees working in the department, all projects assigned to the
department, and all offices occupied by the department. The employee information consists of
employee number (unique), the number of the project on which he or she is working, and his or
her office number and phone number; the project information consists of project number (unique)
and a budget value; and the office information consists of an office number (unique) and the area
of the office in square feet. Also, for each employee the database contains the title of each job the
employee has held, together with date and salary for distinct salary received in that job; and for
each office it contains the numbers (unique) of all phones in that office.
Convert this hierarchical structure to an appropriate collection of normalized relations. Make a
n y a s s u m p t i o n s you deem r e a s o n a b l e ab o u t the d e p e n d e n c i e s
involved.

Department

Employee Project Office

Job Phone

Salary history ER Model 51


Example 4. (cont.)
Department
1 1
1

R4 R5 R6

m m m
1 Project
Employee m R7 Office
1
1 m
m m 1
ID R1
R2
m
m Date m
Salary
history R3
Job 1 Phone

Date Pay Title Desc

52
Example 4. Library Information System.

Draw a normal form ER diagram for a university library


information system which stores information about books,
journals, publishers, students, staff, borrowing of books,
and reservation of books. Note that the library may have
more than one copy for some of the books.

54
Example 4. (solution)

55
Example 5. Online Auction
Consider an ONLINE AUCTION database system in which members
(buyers and sellers) participate in the sale of items. The data
requirements for this system are summarized as follows:
• The online site has members, each of whom is identified by a
unique member number and is described by an e-mail address,
name, password, home address, and phone number.
•A member may be a buyer or a seller. A buyer has a shipping
address recorded in the database. A seller has a bank account
number and routing number recorded in the database.
•Items are placed by a seller for sale and are identified by a
unique item number assigned by the system. Items are also
described by an item title, a description, starting bid price, bidding
increment, the start date of the auction, and the end date of the
auction.
•Items are also categorized based on a fixed classification
hierarchy.
ER Model 56
Example 5. Online Auction (cont.)
• Buyers make bids for items they are interested in. Bid price and
time of bid is recorded. The bidder at the end of the auction with
the highest bid price is declared the winner and a transaction
between buyer and seller may then proceed.

• The buyer and seller may record feedback regarding their


completed transactions. Feedback contains a rating of the other
party participating in the transaction (1-10) and a comment.

Design an Entity-Relationship diagram for the ONLINE AUCTION


database. (Do it yourself).

ER Model 57

You might also like