slide content original, slide layout from database management systems 3ed, r. ramakrishnan and j....
TRANSCRIPT
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1
The Entity-Relationship Model
Chapter 2
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke2
Database Design Basics: Six Steps in Design
1. Data Requirements Analysis: a) what must be stored, b) how will it be used, and c) what actions occur most often.
2. Conceptual Database Design: Use ERD(s) to group data into entities and relationships.
3. Logical Database Design: Convert ERD(s) to conceptual schemas.
4. Schema Refinement: Eliminate redundancy and refine tables for performance.
5. Physical Database Design: Decide how to store and index the data.
6. Application and Security Design: Put the DB in the application’s context.
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke3
ER Model Basics
Employees
ssn
Works_In
Attribute (descriptive attribute), entities (relationships) possess these.
Entity. A group of these is an entity set.
Relationship ( if “ISA”). A group would be a relationship set.
ISA
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke4
ER Model Basics (Example)
class
office
phonename
name
declares MajorStudents
ssn
How do we choose a key?
Candidate keys and primary keys
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke5
ER Model Basics (Example)
class
office
phonename
name
declares MajorStudents
ssn
Two types of constraints to consider: key constraints and participation constratints.
Key constraints can be one-to-many or many-to-many
Participation constraints can be total or partial
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke6
ER Model Basics (Example)
class
office
phonename
name
declares MajorStudents
ssn
Total participation (all)
Total participation and key constraint (all and only one)
Key constraint (only one)
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke7
ER Model: Other Concepts: Weak Entity Sets
rank didname
name
sponsors dependentmember
ssn
These symbols must be “bolded”to denote the weak entity set
The link is “bolded” toshow total participation.It must also have anarrowhead to show a key constraint.
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke8
ER Model: Other Concepts: ISA Relationships
gender
name
employee
id
isa
faculty staff student
salary contract wage ins date wagedate
Two constraints ofconcern with ISArelationships:
* Overlap (no by default)
* Covering (no by default)
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke9
ER Model: Other Concepts: Aggregation
phonename
addr
hires agentcustomer
nameorder
Prod #
buysproduct
name
quantity
price
Could also use aternary relationship