You are on page 1of 8

Database Design – Lecture 6

Moving to a Logical Model


Lecture Objectives
 How to convert from the conceptual model to
the logical model
 Refining the key structure of an entity
 Refining relationships between entities based
on Business Rules

2
Converting Entities
1. Add attributes to each entity
2. Verify PK defined in conceptual model – is it
appropriate for table or does another
unique (generic) PK need to be defined
3. Remove derived values

3
Converting Relationships
4. For 1:M connectivity, take the PK of the ‘1’
table and make it an FK in the ‘M’ table
5. For M:N connectivity, create a bridge table
 Include the PK from each of the original tables
as composite PK in the bridge table. These will
also be FKs in the bridge table
 Add additional attributes to the bridge table as
required
6. For Strong – Weak Entity relationships, take
the PK of the Strong Entity and include it as
part of the PK of the Weak Entity. It will
also be an FK in the Weak Entity
4
Example Conversion
 Given the
following ERD, LIBRARIAN

convert to a PK EMPL_ID

logical model
NAME

using the CUSTOMER

techniques
CATEGORY BOOK
PK CUST_ID
PK CAT_ID PK,FK1 BOOK_ID

provided
NAME
CAT_NAME FK2 CUST_ID
FK1 BOOK_ID

5
Example Conversion Note relationship
appropriate now
between librarian and
borrow transactions

1. Add attributes LIBRARIAN


PK EMPL_ID
Note new entity
created to

Refine PK’s (this handle M:N


CUSTOMER NAME
2. PK CUST_ID relationship

may involve between book


can generate
has
and customer

creating a new, BORROW_TRANSACTION

PK TRANS_ID CATEGORY

more meaningful FK1


FK2
CUST_ID
EMPL_ID
PK CAT_ID

PK)
CAT_NAME

has

Remove derived
contains

3. BORROW_DETAIL

values (none in this


PK,FK1 TRANS_ID BOOK
PK LINE_NUMBER
can be on PK BOOK_ID

example)
FK2 BOOK_ID
FK1 CAT_ID

4. All relationships
revised (1:1, 1:M,
M:N) 6
In Summary
 A conceptual model can have a few attributes or
many attributes depending on the level of detail
provided in a narrative
 Most often, we will add as many attributes as
are known to the initial conceptual model to get
it to an adequate level of detail (or as close to
logical as possible)

7
Example Logical Design
SAS (Support A Student) Window Cleaning wants to
keep track of its students and the jobs they are
assigned. For an employee information such as
name, address, email and phone number are
required. Students are grouped into job categories
as their salary is calculated by the category they are
in. The category includes code, description and
hourly rate. A student can on have one job category
at a time but each job category can have many
students. All jobs are tracked by an id number, a
start date, an end date and a cost. More than one
employee will work on a job and an employee will
have many jobs assigned to them. 8

You might also like