COMM 335 - Information Systems Technology and Development Database Design
COMM 335 - Information Systems Technology and Development Database Design
Learning Objectives
Learning Objective 1
1. Design a relational database using
Entity Relationship Diagram (ERD)
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 3 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 4
Database Modeling Database Modeling (cont’d)
Also called data modeling, is a technique When designing a database, you can think of it as
used to develop an anomaly-free database three different realms (domain):
with database integrity. Database designer
Database builder
A model is a representation of real objects,
Database user
events, or systems.
Most models are built using specific symbols.
Models are used for understanding, analyzing,
and documenting real systems.
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 5 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 6
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 7 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 8
Entity Relationship
Diagram (ERD) Database Entities
An order is Entity: A person, object, event, or concept in
placed by only
one customer.
the user environment about which the
organization wishes to maintain data, e.g.
Person : STUDENT, CUSTOMER
Object : PRODUCT, BUILDING
Event : SALE, REGISTRATION
A customer may Concept : ACCOUNT, COURSE
place zero or
more orders.
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 9 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 10
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 11 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 12
Attributes in Entity Rectangle Entity Identifiers
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 13 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 14
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 15 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 16
Entity Relationship Diagram (ERD)
with Crow’s Feet Symbols How To Build an ERD
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 17 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 18
ERD Relationship
How To Build an ERD (cont’d) Cardinality Symbols
Intersection
Table
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 21 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 22
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 25 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 26
Database Integrity refers to the database Rule 3. Domain Integrity. The field values must be
from a predefined domain.
containing accurate, valid and complete data.
o For example, the Date field must have a date and not any
other values.
Rule 1. Entity Integrity. Each record in the database
must have a unique identifier (i.e. a unique primary Rule 4. Referential Integrity. Data referenced and
key). No two records in the database table can have stored in related tables must be consistent across the
the same primary key value. database.
o For example, a customer address should be the same in
Rule 2. Primary Key Integrity. The primary key value any table in which it is referenced. Referential integrity is
cannot be null (empty). Each record must have a value improved when the customer address is stored in one
location only.
for the primary key field. Details to be covered
in the Tutorials.
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 29 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 30
© 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 33 © 2019 – Y.M. Cheung COMM 335 - Winter 2019 Term 1 34