Professional Documents
Culture Documents
Analysis
Logical Design Physical Design Implementation Maintenance Logical database design Physical database design and definition Database implementation Database maintenance
2
Overview
What is data modeling Importance of data modeling Business rules Entity-relationship model: entities, relationships, and attributes
Input for follow-up processes Data rather than processes are the most complex Data tend to be more stable than business processes
Business Rules
Statements that define or constrain some aspect of the business. For example:
Friday is business casual dress day Students can only register a course if prerequisite is successfully completed
Entity-Relationship Model
A logical representation of the data for an organization or for a business area 3 constructs:
STUDENT
Name Registers
Entity - person, place, object, event, concept (often corresponds to a row in a table) Attribute - property or characteristic of an entity (often corresponds to a field in a table) Relationship link between entities (corresponds to primary key-foreign key equivalencies in related tables) Type vs. instance
Entity-Relationship Diagram
A graphical representation of entity-relationship model Also called E-R diagram or just ERD
7
Attribute
Supplier_ID Supplier_Name
Supplier_Address
Entity
Person: EMPLOYEE, STUDENT Place: WAREHOUSE, COUNTRY Object: BUILDING, MACHINE Event: SALE, REGISTRATION Concept: ACCOUNT, COURSE
EMPLOYEE DEPENDENT
Strong entity
Weak entity
SHOULD BE:
An object that will have many instances in the database An object that will be composed of multiple attributes An object that we are trying to model
11
Figure 3-4
Inappropriate entities
System user
System output
Appropriate entities
12
Attribute
13
Optional attributes
Phone_Number Password_Hint
14
15
Figure 3-8 Entity with a multivalued attribute (Skill) and derived attribute (Years_Employed)
Derived
from date employed and current date
Multivalued:
an employee can have more than one skill
16
Identifiers (Keys)
Identifier (Key) - An attribute (or combination of attributes) that uniquely identifies individual instances of an entity type Candidate Key an attribute that could be a key. Examples (for STUDENT, PERSON)? Simple Key versus Composite Key
18
19
Flight_Number
Date
20
Will not change in value Will not be null Substitute new, simple keys for long, composite keys
? Game_Number
21
Relationship
Relationship Type vs. Relationship Instance Degree of a relationship Cardinality of a relationship Associative Entity combination of relationship and entity
22
Figure 3-11a
The relationship type is modeled as the diamond and lines between entity types
23
25
Cardinality of a Relationship
One-to-One
Each entity in the relationship will have exactly one related entity
One-to-Many
An entity on one side of the relationship can have many related entities, but an entity on the other side will have a maximum of one related entity
Entities on both sides of the relationship can have many related entities on the other side
26
Many-to-Many
27
28
Cardinality Constraints
Cardinality Constraints - the number of instances of one entity that can or must be associated with each instance of another entity Minimum Cardinality. Examples?
30
Cardinalities
Mandatory one Mandatory many Optional one Optional many
18 11
31
32
33
34
35
Attributes or Relationship?
Attributes or Relationship?
Associative Entities
Its an
entity
AND its a
relationship
All relationships for the associative entity should be many The associative entity could have meaning independent of the other entities The associative entity should have at least one or more
attributes other than the identifier The associative entity may participate in other relationships
other than the entities of the associated relationship Ternary relationships should be converted to associative entities
38
39
40
41
Strong entities
exist independently of other types of entities has its own unique identifier represented with single-line rectangle
dependent on a strong entitycannot exist on its own does not have a unique identifier represented with double-line rectangle links strong entities to weak entities represented with double line diamond
42
Weak entity
Identifying relationship
Strong entity
Identifying relationship
Weak entity
43
44
Different modeling software tools may have different notation for the same constructs
45
46
Attribute
Supplier_ID Supplier_Name
Supplier_Address
47