comp101-lect03
comp101-lect03
Foundations
of
Information
Systems
Lecture 3: (I)
Entity-Relationship
Data Modelling
Diagrams Stephen
Cranefield
Department of
Information
Science
Paper Structure
Section 1: Databases
(storing and retrieving You are here!
organized information)
Representations
Section 4: Algorithms
(execution of
instructions)
2
Information System Components
[Source: Stair & Reynolds – Principles of Information Systems (2009), page 12] 4
Topics for the next 7 (or 8) lectures
5
What is a database?
6
Database clients and servers
• Various software
applications access a
central database by
sending queries and
receiving results
• See lecture 5 to 8 on the
database query language
SQL
• Direct human interaction
with a DB is usually only
done by database
administrators
9
What a
database
administrat
or would
see
Why use a database?
• Uniformity of representation
• More consistent data, reduced duplication
• Easier to manipulate and query
• Data independence
• Application-neutral data persistence
12
Data duplication
14
Database management system
(DBMS)
• Software to create and manage databases
(COMP 101 uses the PostgreSQL DBMS)
• Security
• Concurrent access
• Failure recovery
15
2. Data Modelling
Capturing the requirements for your database scheme
16
Motivation 1
Different organisations have different
information needs
8
Motivation 3
Information is
connected
• University students enrol in papers that are
offered by departments
• Sales of products are made by customers
• Be able to:
• Explain ERD key concepts
• Read and interpret ERD examples
• Draw an ERD that matches given business rules
11
Example: recording sales
22
Entity-relationship diagram (ERD)
Entity (may end up as a table in a database)
} Attributes
(may end up as columns
in a database table)
Relationship
Unique identifier
(primary key).
Can be a
combination of two {
attributes as shown
here
Notes
:
1) Th is u s es t h e “ In fo r m a t io n E n gi n e e ri n
• T hi s is In fo r m a tio n E ng i n ee rin g n o t at io n ,
go”n: evaorfiamnatnoy fdEifRfeDrenntoEtaRtDionnotations
2) •DaSsohlieddanadnddassohleidd lliinneess
hfoavreresulabttiloyndsifhfeipresnht amveeasnpinegcsif–icwme
weaillniignngosreththaattwineCwOoMnP’t101 discuss
Entity
• “…a thing or object of significance,
whether real or imagined, about which
information needs to be known or held”
(Barker, 1990)
Employee Product
Customer Location
Transaction Departme
nt
17
How do we tell
whether something
is an entity?
1. Is it a specific type of thing we need to
know about?
Types
Instances
(possibly many instances of a single
entity)
…
Entities vs. Instances/Data items
21
Attribute
• Examples:
• A student ID is unique to a specific student
• A sale line needs both the sale number and
product code to identify it uniquely
23
Notation for unique IDs
• Often shown in a
separate compartment
Student ID
• Unique ID
(“primary
key”)
• Then other attributes
Relationship
• Reflects a real-world association
between entities:
• A sale is to a customer
• A sale is made by an employee
• An employee has an assigned office
• Properties of a relationship:
• Cardinality: one to one, one to many, many to many
• Participation: optional or mandatory
Relationship cardinality
Movie Director
• Director to Movie:
A Director may direct many Movies
(or: a director directs zero or more movies)
ERD Summary
• Business analysts need to analyse the nature
of the data that the business collects and
generates
• ERDs provide a high level notation for
modelling the structure and relationships
between different types of data
• ERDs can be used to capture database
requirements graphically, discuss with
others, and pass on to database designers
• ERDs are models of the data that needs to be
stored
– they don’t deal with actual data instances.
Exercise 1: understand ERD notation
• Identify the
following in the ERD
at left:
• Entities
• Attributes
• Unique identifiers
• Relationship(s) where
participation is
mandatory on both
sides
• Describe the
relationship between
Customer and Sale
Header in plain
English
40
Exercise 2: interpret an ERD
39
Thanks!
Questions?