Professional Documents
Culture Documents
Database Design
4
Data Modeling
• Requirements analysis →
• Conceptual Database design →
• Logical Database design →
• Schema refinement →
• Physical Database design
• Applications and security
4
Conceptual design: (ER Model is used
at this stage.)
Entity/Relationship Modelling
Entity/Relationship Diagrams
Entities
Diagramming Entities
Attributes
Classes of attributes
• Simple attribute
• Composite attribute
• Derived attributes
• Single-valued attribute
• Multi-valued attribute
10
4
Simple/Composite attribute
• A simple attribute cannot be subdivided.
– Examples: Age, Gender, and Marital status
• A composite attribute can be further
subdivided to yield additional attributes.
– Examples:
• ADDRESS -- Street, City, State, Zip
• PHONE NUMBER -- Area code, Exchange number
11
4
Derived attribute
• is not physically stored within the database
• instead, it is derived by using an algorithm.
– Example 1: Late Charge of 2%
• MS Access: InvoiceAmt * 0.02
– Example 2: AGE can be derived from the date of
birth and the current date.
• MS Access: int(Date() – Emp_Dob)/365)
12
4
Single-valued attribute
• can have only a single (atomic) value.
– Examples:
• A person can have only one social security number.
• A manufactured part can have only one serial
number.
– A single-valued attribute is not necessarily a
simple attribute.
• Part No: CA-08-02-189935
• Location: CA, Factory#:08, shift#: 02, part#: 189935
13
4
Multi-valued attributes
• can have many values.
– Examples:
• A person may have several college degrees.
• A household may have several phones with different
numbers
• A car color
14
4
Diagramming Attributes
Relationships
Cardinality Ratios
Diagramming Relationships
One Many
Example
Example - Entities
Example - Relationships
Department
Student
Offers Department
Student
Offers Department
Student
Offers Department
Enrols In Student
Offers Department
Takes
Enrols In Student
Offers Department
Takes
Enrols In Student
Takes
Enrols In Student
Takes
Takes
Example
Example - Entities/Attributes
Description Product
Street address
Example - Relationships
Description Product
Description Product
Has A
Example
“A database will be made to store information about patients in a
hospital. On arrival, each patient’s personal details (name,
address, and telephone number) are recorded where possible, and
they are given an admission number. They are then assigned to a
particular ward (Accident and Emergency, Cardiology, Oncology,
etc.). In each ward there are a number of doctors and nurses. A
patient will be treated by one doctor and several nurses over the
course of their stay, and each doctor and nurse may be involved
with several patients at any given time.”