CSE 581 Introduction to DBMS

advertisement
CSE 581 Introduction to DBMS
Summary notes on Chapter 6: Database design and the E-R Model
The focus of this chapter is on the entity-relationship data model (ER model) for
conceptual design of database. This model identifies the entries in an environment and
how they are related via relationships. The design is then transformed into a set of
relation schemas. Various issue related to this design are discussed at length. A
summary the model and related issues is presented in the following.
Key terms and concepts:
Entities and entity sets; relationships and relationships sets; attributes; mapping
constraints (cardinalities); keys; strong and weak entity sets; ER schema(diagram) to
tables; generalization and specialization.
Other terms and concepts
Domain of an attribute; attribute types; participation constraints(total, partial); design
issues(entity vs. relationship, binary vs. n-ary, placement of attributes, ect.); notations
for ER diagram; design phases; keys for relationship sets.
Section 6.1 Design process: Design proceeds as follows:
¾ Identify data needs leading up to user requirements and specifications
¾ Choose data model and translate requirements to conceptual design of the DBhere we use the ER model for this purpose which is used to create the ER diagram,
a graphical representation of the schema.
¾ Logical design phase then maps the conceptual schema to implementation data
model- we use relational data model (Chapter2).
¾ Physical design phase specifies the physical features, e.g., files and data structures
of the database (Chapter11) and access methods used (Chapter12).
During the above phrase, several alternatives are considered and the process proceeds
iteratively.
Section 6.2 ER model
The model is based on the notions of entities and relationships among them. Also, the
appropriate attributes are associated with them. Each attribute has a domain (set of
allowable values) that is also specified here.
Section 6.3 Constraints
Database contents have application dependent constraints: mappings, keys,
participation.
Mapping: one-one, one-many, many-one, many-many; keys; super, candidate,
primary; participation: total, partial.
Section 6.4 ER diagram
An ER diagram is a graphical representation of the overall structure of the DB.
Certain notations and conventions are used in this diagram-not all are universalrectangles for entity sets, diamonds for relationships, ovals for attribute sets, labels in
links to state mapping cardinalities, etc.
Section 6.5 ER diagram issues
¾
¾
¾
¾
Entity set versus attribute
Use of entity or relationship set
Binary versus n-ary relationships
Placement if attributes in relationship sets
Section 6.6 Weak entity sets
Sets that do not have their own primary keys
Section 6.7 Extended ER features
Extensions to the basic ER model- specialization, generalization, aggregation-provide
enhanced expressive power to the ER model for capturing the modeled environment.
Section 6.8 DB design for a banking enterprise
Gives detailed description of DB design for a banking enterprise. Presents the
requirements, identities the entity and relationship sets, and finally develops an ER
diagram.
Section 6.9 Reduction to relational schemas
ER diagram is mapped to a collection of relational schemas. (Note that the ER
diagram and the schemas are abstract, logical representations of the real world
enterprise). Also discussed are representations of strong and weak entity sets,
relationship sets, attributes, generalization and aggregation. The schemas for the
banking enterprise are given in Section 6.9.7
Section 6.10 Other aspects of DB design
Data constraints; performance: throughput and response time; authorization; dataflow
and workflow considerations; and design for future modifications.
Mapping Constraints (Types)
1. Consider several mapping types
a) One to one : Assume that at a time a husband has one wife and a wife has
one husband. Then any occurrence of the entity HUSBAND (i.e., any
Husband) is associated with only one occurrence of the entity WIFE (i.e.,
one Wife).
b) One to many: A doctor has many patients but the rules of the practice
dictate that a patient is registered with only one doctor.
c) Many to Many: A musician plays in many concerts and a concert is
performed by many musicians.
2. Examples
a) one to one
b) one to many
Doctor
Dr. Craign
Patients
Miss Sadler
Mr. Bloxham
Mr. Mclean
Dr. Paterson
Mr. Dean
Mrs. Drury
c) many to many
Download