CSE1IS Information Systems
Week 7 Lecture 2
Entity-Relationship Diagram Example

1. Relational Database:

Housewares WareHouse
1234 First Avenue
Camberwell 3200
Packing Slip Number: 128695

Customer Account: 33465
Ship To:
Harry's Hardware
4036 South Lowden Rd
Camberwell, 3022

Shipping Date: 23 August 2006
Shipping Instructions:
Contact Fred the Foreman on arrival
Item Number Description Qty
Ordered
Filled /
Qty Shipped
23764
46587
54602
Replacement Blade
Food processor
Radio
  5
  3
10
Y
2
Y

This Packing Slip - and others - could be stored in a relational database (abbreviated) as:

Table 1: Inventory

ITEMCODE DESCRIPTION PRICE  QOH  ....  
23764 Replacement Blade   7  
30011 Can Opener   2  
39115 Electric Kettle   18  
46587 Food processor   12  
54602 Radio   5  

Table 2: PackingSlip
PSLIP# CUST# SHIPDATE SHIPTO INSTRUCTIONS
  1286950 547 22-08-2006 Sally's ... Before noon  
  1286952 33465 23-08-2006 Harry's ... Contact Fred ...
      :        

Table 3: PackingItems
PSLIP# ITEMCODE QTY
ORDERED
QTY
SHIPPED
FILLED 
1286950 54602 6 4 N
1286950 30011 3 3
1286952 23764 5 5
1286952 46587 3 2
1286952 54602 10 10
      :        

Can you construct an ERD for the Packing Slip?

2. Converting E-R Diagrams into Relational Tables:

Three steps:

1 Entities:

2 One-to-Many Relationships:

3 Many-to-Many Relationships:

eg.:

becomes:

  
3. Student-Course Example from text:

From S.C.&R. pp.329-333:

'TAKES' is M:N relationship (Associative Entity) and so may be converted into an entity:

And, the tables then may look like:

4. Example based on the lecturer's subject administration system

In particular the extra tute question Week 6 Tute 2 (with solution )

Step 1: define Entities:

Step 2: define Relationships:

Step 3: draw ER Diagram:

Step 4: define Relational Database tables:

References:


Copyright © 2006 L. Staehr, B. Choi, C. Cope, J. McCullagh, P. Somerville, C. Matthews, B. Retallick
This lecture last updated on 11/07/2006 by  Brian Retallick, La Trobe University, Bendigo

NOTE: this webpage has not been brought up to WCAG 1.0 standard nor does it contain validated HTML