Lec - 5 - Basic ER
Lec - 5 - Basic ER
Conceptual Conceptual
Informal
Design Model
Physical/ DBA
Operation, Mainte- Evolving
nance, & Tuning Database
CS204 Database System 5
Database Development …
Requirements Analysis
Collect and Analyze the requirements of the users, e.g., Functional Specification,
Prototyping.
Conceptual Design
Design a conceptual model (schema), e.g., ER model, ER Design, ER Mapping.
Logical Design
Translate the ER model into a relational model (schema), DDL Scripts (e.g., ER Mapping
to DDL)
Normalization
Database Building
Build the database and write application programs for specific DBMS & S/W Appls/
Tools.
Operation, Maintenance & Tuning
Use/ Training, Installations, maintain and “tune” the database.
6
Goals for Conceptual/ Logical Design
• Simplicity
– Users should understand the design
– Data model should match users’ conceptual model
– Queries should be easy and intuitive to write
• Expressiveness
– Include enough information to answer all important
queries
– Include all relevant data (without irrelevant data)
– Design must be within well-defined scope
• Performance
– An efficient physical design (DBA) should be possible
Conceptual Model
• Highest conceptual grouping of ideas
– Data tends to naturally cluster with data from the
same or similar categories relevant to the
organization
• The major relationships between
subjects have been defined
– Least amount of detail
8
Conceptual Model…
• Conceptual design
– Entity-Relationship (ER) Modeling
• Entities - “things” in the real world
– E.g. Car,Account, Product Car Account Product
• Attributes – property of an entity, entity type, or
relationship type Car Color
– E.g. color of a car, balance of an account, price of a product
•Relationships – between entities there can be
relationships, which also can have attributes
– E.g. Person owns Car
owns
Person Car
9
Conceptual Model to Reality
Level 0--Reality. This is the actual real data that managers use.
14
For Logical Design
• Translate an ER schema into a relational schema.
– Entity
– Relationship
– Attribute
– Subtype
• Normalization
– To ensure you have a “good” design (Testing of your model).
ENTITY TYPE
RELATIONSHIP TYPE
ATTRIBUTE
KEY ATTRIBUTE
MULTIVALUED ATTRIBUTE
COMPOSITE ATTRIBUTE
DERIVED ATTRIBUTE
E1 R E2 TOTAL PARTICIPATION OF E2 IN R
17
Example COMPANY Database – 2.
We store each EMPLOYEE’s social security number, address, salary,
gender, and birthdate.
Each employee works for one department but may work on several projects.
We keep track of the number of hours per week that an employee currently
works on each project.
For each dependent, we keep track of their name, gender, birthdate, and
relationship to employee.
18
We will aim to Draw ER DIAGRAM FOR THE COMPANY DATABASE
19
End