• No results found

Group Project

N/A
N/A
Protected

Academic year: 2021

Share "Group Project"

Copied!
36
0
0

Loading.... (view fulltext now)

Full text

(1)

Group Project

(2)

Roadmap

1. Collect requirements (users, views, constraints, tasks)

2. Model requirements and validate (ERD and EERD)

3. Map ERD to relational model

4. Verify model with relational algebra

5. Build model using DBMS (SQL)

6. Optimize model (Normalization and Indexing)

7. Build transactions and other user

tools Intro. To DBMS 2

(3)

Project Assignment

1. Collect requirements (users, views, constraints, tasks)

(4)

Roadmap

1. Collect requirements (users, views, constraints, tasks)

2. Model requirements and validate (ERD and EERD)

3. Map ERD to relational model

4. Verify model with relational algebra

5. Build model using DBMS (SQL)

6. Optimize model (Normalization and Indexing)

7. Build transactions and other user

tools Intro. To DBMS 4

(5)

THE ENTITY–

RELATIONSHIP

MODEL

(6)

Entity-Relationship Model 6

Data Modeling Using the ER Model

ER Diagrams- Notation

Example Database Application (COMPANY)

ER Model Concepts

Entities and Attributes

Entity Types, Value Sets, and Key Attributes

Relationships and Relationship Types

Weak Entity Types

Roles and Attributes in Relationship Types

Relationships of Higher Degree

(7)

Reasons for Modeling

Learn from the modeling process

Reduce complexity by abstraction

Remember details

Communication

with team

with variety of stakeholders

Documentation for future reference

(8)

Entity-Relationship Model 8

Entity-Relationship (ER) Model

Helpful for conceptualizing the Real World

Shows simple, static memory of a system

Entity: A thing that exists

e.g. person, automobile, department, employee

Entity Set: A group of similar entities

e.g. all persons, all automobiles, all employees

Attribute: Property of an entity or relationship

e.g. person - name, address

Domain: Set of values allowed for an attribute

(9)

Simple COMPANY Database

Employees

Have unique ID, name, address

work for a department

may work on many projects

May work on no project

Departments

Have unique Department Number and Manager

Projects

Have unique Project Number

Need to track hours per week that employee works on each project

(10)

Entity-Relationship Model 10

Entity Sets and Attributes

Employees E#, ENAME, ADDRESS Departments D#, DNAME

Projects P#, PNAME E n t i t i e s

A t t r i b u t e s

Entity: A thing that exists

Entity Set: A group of similar entities

Attribute: Property of an entity or relationship

(11)

Entity-Relationship Diagram Notation

Entity Sets - rectangles

Attributes - circles

linked to entity sets or relationships by edges

Relationships - diamonds

linked to entity sets by edges

(12)

Entity-Relationship Model 12

Example: Relationships and Attributes

Project Employee Assigned

To

Employee Is Department

In

%TIME

(13)

Attribute Notation

Simple (atomic)

Composite

Employee Employee

Employee

LName FName

Name Empno

LName FName

(14)

Entity-Relationship Model 14

Multi-valued Attribute Attribute Notation

Student Major

(15)

Attribute Notation

Derived Attributes - Include in Department the average

salary of the employees in the department.

Employee Department

Salary AvgSal

Member Of

(16)

Entity-Relationship Model 16

Constraints on Relationships between Entity Sets

EmployeesE#, ENAME, ADDRESS Departments D#, DNAME

Projects P#, PNAME

Cardinality

Employees may be assigned to only 1 department at a time.

Employees may be assigned to several projects at once, each with an associated %time.

(17)

Cardinality in Relationships

Employees may be assigned to only 1

department at a time.

Employees may be assigned to

several projects at once, each with an associated %time.

Project Employee Assigned

To

Employee Is Department

In

%TIME

1

M N

N

(18)

Entity-Relationship Model 18

Participation: Total or Partial Employees must be assigned to a

department.

Total: Each entity must be included at least once in the relationship.

Employees need not be assigned to any projects.

Partial: Each entity instance need not be included at least once in the relationship.

(19)

Participation in Relationships

Partial Total

Project Employee Assigned

To

Employee Is Department

In

%TIME

1

M N

N

(20)

Entity-Relationship Model

Cardinality: Min-Max Constraint Notation

Original “Chen” Notation

Alternate “Constraint” Notation: (min, max)

Min represents participation (0 partial, >0 total).

Max represents cardinality.

Employee Works Project

Employee Works Project

1 n

(1,…)(1, 1) (0, n)(0,…)

(21)

Cardinality: Min-Max Constraint Notation

Original “Chen” Notation

Alternate “Constraint” Notation: (min, max)

Min represents participation (0 partial, >0 total).

Employee Works Project

Employee Works Project

1 n

(1,…)(1, 1) (0, n)(0,…)

(22)

Entity-Relationship Model 22

Weak Entities

Do not have key attributes of their own

Identified by being related to specific entities from another entity type

Always has a total participation constraint

Entity Dependent contains children of employees. No key attribute.

Dependents are identified by an employee. Entity Set Employee is called the Identifying Relationship or Owner Entity Type

Name in Dependent is a Partial Key

Name

Employee Dependents

Of Dependent

Name E#

1 N

(23)

ER Diagrams Notation

Summary

(24)

Give an example of a:

Compound attribute

(25)
(26)

Give an example of a:

Multivalued attribute

(27)
(28)

Give an example of a:

Partial key

(29)
(30)

Give an example of a:

Attribute of a relationship

(31)
(32)

Give an example of a:

Total participation in a relationship

(33)
(34)

Give an example of a:

One to one cardinality in a relationship

(35)
(36)

Worksheet

Complete E-R Worksheet I with classmate(s)

36

References

Related documents

• Primary keys allow entity sets and relationship sets to be expressed uniformly as tables which represent the contents of the database. • A database which conforms to an E - R

 Owner entity set and weak entity set must participate in a one- to-many relationship set (one owner, many weak entities).  Weak entity set must have total participation in

• Total participation (indicated by double line): every entity in the entity set participates in at least one relationship in the relationship set.

 Owner entity set and weak entity set must participate in a one-to- many relationship set (one owner, many weak entities).  Weak entity set must have total participation in this

As you develop an entity-relationship diagram for a database, you identify each data entity and relationship used by the organization. An entity is a general category of

n They are specified for the attributes of entities (or relationships) and describe the minimum and maximum number of values of the attribute associated with instances of

• The Entity-Relationship Model is often referred to as a semantic data model, because it more closely resembles real world scenarios than, e.g., the relational model... In the

In some cases, a ternary relationship can be represented as a weak entity if the data model allows a weak entity type to have multiple identifying relationships (and hence