DB Lec8
DB Lec8
(ER) Model
ER diagrams
◦ Diagrammatic notation associated with the ER model
Using High-Level Conceptual
Data Models for Database Design
Requirements collection and analysis
◦ Database designers interview prospective database users to understand and
document data requirements
◦ Result: data requirements
◦ Functional requirements of the application
Using High-Level Conceptual
Data Models (cont’d.)
Conceptual schema
◦ Conceptual design
◦ Description of data requirements
◦ Includes detailed descriptions of the entity types, relationships, and
constraints
◦ Transformed from high-level data model into implementation data model
Using High-Level Conceptual
Data Models (cont.)
Logical design or data model mapping
◦ Result is a database schema in implementation data model of DBMS
Attributes
◦ Particular properties that describe entity
◦ Types of attributes:
◦ Composite versus simple (atomic) attributes
◦ Single-valued versus multivalued attributes
◦ Stored versus derived attributes
◦ NULL values
◦ Complex attributes
Entities and Attributes (cont.)
Entity Types, Entity
Sets, Keys, and Value
Sets
Entity type
◦ Collection (or set) of entities that have the same attributes
Entity Types, Entity Sets, Keys, and Value
Sets (cont.)
Key or uniqueness constraint
◦ Attributes whose values are distinct for each individual entity in entity set
◦ Key attribute
◦ Uniqueness property must hold for every entity set of the entity type
Relationship
◦ When an attribute of one entity type refers to another entity type
Relationship instances ri
◦ Binary, ternary
Relationships as attributes
◦ Think of a binary relationship type in terms of attributes
Role Names and
Recursive Relationships
Role names and recursive relationships
◦ Role name signifies role that a participating entity plays in each relationship
instance
Recursive relationships
◦ Same entity type participates more than once in a relationship type in
different roles
◦ Must specify role name
Constraints on Binary
Relationship Types
Cardinality ratio for a binary relationship
◦ Specifies maximum number of relationship instances that entity can
participate in
Participation constraint
◦ Specifies whether existence of entity depends on its being related to
another entity
◦ Types: total and partial
Attributes of Relationship
Types
Attributes of 1:1 or 1:N relationship types can be migrated to one entity
type
For a 1:N relationship type
◦ Relationship attribute can be migrated only to entity type on N-side of
relationship
Identifying relationship
◦ Relates a weak entity type to its owner
gre ssn
salary Student
name
(0,1) Grad
(1,*)
(0,*) gpa
employs
assoc
(0,75) (0.*)
took title
Department (0,*) Cou#
(0,*)
Semester Course
name grade (0,*)
semesterid
offered
(1,1)
Indicate the cardinalities for each relationship type; assign roles (role names) to each relationship
if there are ambiguities! Use sub-types, if helpful to express constraints!
Sal
empl. (0,4) ssn name
name Manager
(1,3)
Team Person
city (24,99) (0,1)
Home Visit
contr Player birthd
(0,*) (0,*)
Sal (0,*) weight height pos
play played-in.
score
(1,1)
min
(22,*)
Scoring:
1. Play relationship a Set: 3
2. Person/Player/Manager: 3 Game Date
3. Weak Game Entity: 3
4. Played-in: 2
5. Can Only Play once on a day: 1
6. Contract: 3
7. Salary, score, min attribute: 3