Docsity

Entity-Relationship (ER) Diagrams in Database Design, Study notes of Design

Partial preview of the text

Download Entity-Relationship (ER) Diagrams in Database Design and more Study notes Design in PDF only on Docsity!

Entity-Relationship (ER) Diagrams

Lecture 7

Entity-Relationship (ER) Diagrams

Outline

1. Context

  • Design & Implementation Process

2. Goals of Conceptual Design

3. Entity-Relationship (ER) Model

4. One ER Diagrammatic Notation

5. Requirements Elicitation

6. Approaches to Conceptual Design

Entity-Relationship (ER) Diagrams

Goal of Conceptual Design

Description of data requirements that isโ€ฆ
Comprehensive
  • Entity types, relationships, and constraints
  • Sanity check of data & functional requirements
  • Reference for [unit/integration] testing/analysis
Concise/High-level
  • Easy to understand technically
  • Easy to communicate with non-technical users
  • Facilitates focus on data (vs. storage/implementation details)
Algorithmically Transformable
  • Improves application development efficiency, reduces errors Entity-Relationship (ER) Diagrams

Entity-Relationship (ER) Model

Entity

  • Thing in the real world

Attribute

  • Property of an entity
  • Most of what we store in the database

Relationship

  • Association between sets of entities
  • Possibly with attribute(s) Entity-Relationship (ER) Diagrams

Entity Sets

Set of entities that have the same attributes

All cars have a year,

make, and model.

Entity-Relationship (ER) Diagrams

CAR

Make Year Model

Composite Attributes

Can be subdivided into smaller subparts

All cars have a year,

make, model, and

registration.

Entity-Relationship (ER) Diagrams

CAR

Make Year Model Registration State Number

Key Attributes

The value uniquely identifies each entity

All cars have a year,

make, model,

registration (unique),

vehicle number (vin;

unique), some number

of colors.

Entity-Relationship (ER) Diagrams

CAR

Make Year Model Registration State Number

Color CAR VIN

Make Year Model Registration State Number Color VIN

Potential Pitfall

  • In^ relational schema, underlining multiple

attributes indicates that for all rows, the

combination is unique

  • In^ ERDs, underlining multiple attributes indicates that each individually can

uniquely identify an entity

Entity-Relationship (ER) Diagrams

Exercise

Draw an ERD for the following description:

Each department has a unique name, a unique number, and a particular employee who manages the department. We keep track of the start date when that employee began managing the department. A department may have several locations. Entity-Relationship (ER) Diagrams

Answer

Entity-Relationship (ER) Diagrams

Location DEPARTMENT Manager

Name Number Manager_ Start_Date

Answer

Entity-Relationship (ER) Diagrams

Location PROJECT

Name Number Controlling_ Department

Exercise

Draw an ERD for the following description: We store each employeeโ€™s name (first, last, MI), Social Security number (SSN), street address, salary, sex (gender), and birth date. An employee is assigned to one department, but may work on several projects, which are not necessarily controlled by the same department. We keep track of the current number of hours per week that an employee works on each project. We also keep track of the direct supervisor of each employee (who is another employee). Entity-Relationship (ER) Diagrams

Exercise

Draw an ERD for the following description:

We want to keep track of the dependents of each employee for insurance purposes. We keep each dependentโ€™s first name, sex, birth date, and relationship to the employee. Entity-Relationship (ER) Diagrams

Answer

Entity-Relationship (ER) Diagrams Employee

DEPENDENT

Sex DName DBirthdate Relationship