concepts of database management seventh edition chapter 6 database design : erd model

31
Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Upload: rolf-pierce

Post on 17-Dec-2015

222 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Concepts of Database ManagementSeventh Edition

Chapter 6

Database Design : ERD Model

Page 2: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Objectives

• Discuss the general process and goals of database design

• Identify the different symbols used in ERD

• Identify cardinality symbols to used for different entity relationship types

• Create an entity-relationship (E-R) diagram to visually represent a database design

2

Page 3: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Objectives (continued)

• Explain the physical-level design process

• Discuss top-down and bottom-up approaches to database design and examine the advantages and disadvantages of both methods

• Use a survey form to obtain information from users prior to beginning the database design process

• Review existing documents to obtain information prior to beginning the database design

3

Page 4: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

The Entity-Relationship Model

• is modeling tool used to depict graphically a database design before it is actually implemented.

• It has three basic components, namely, an Entity, Relationship and an Attribute.

• And Relationship has Cardinality (as we will see more in a moment)

4

Page 5: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Introduction

• Two-step process for database design

• Information-level design: completed independently of any particular DBMS

• Physical-level design: information-level design adapted for the specific DBMS that will be used– Must consider characteristics of the particular DBMS

5

Page 6: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Building Blocks of ERD

6

Type English Grammar Equivalent Example

Entity Proper Noun Student, Employee, Instructor, Courses, Room

Relationship Verb has, teaches, belongs, handles

Attribute Adjective Height, Age, Gender, Nationality, First name

Page 7: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

ERD Popular Notation

• Chen Notation• Crow’s Foot Notation

7

Page 8: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Chen Notation - Symbol

8

1 M

Rectangle represents an Entity

Diamond represents a Relationship

Lines with labels represents Cardinality

Page 9: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Entity (Chen Notation)

• is a real-world object distinguishable or unique from other objects.

• An entity can be a concrete or physical object like employee, student, faculty, customer etc. Or it could also be conceptual or abstract like transaction, order, course, subjects etc.

• It can be thought of as a noun like student, employee etc.

• It is normally represented by a rectangle shape.

9

Page 10: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Database Background• Remember in Chapter 1 Entity could be a :

10

Person

Place

(ex. Teacher, Student, Physician)

(ex. School, Hotel, Store )

Object(ex. Mouse, Books, Bulding )

Event (ex. Enroll, Withdraw, Order )

Idea or Concept (ex. Courses, Account, Delivery )

Page 11: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Entity - Example

• For example in our Premiere Database the different Entities are the following:

11

Customer Sales Rep

Order

Parts

Page 12: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Relationship

• is a way of relating one entity to another. Entities can therefore participate in a relationship.

• it is commonly thought as a verb connecting the entities or nouns.

• It is normally represented by a diamond shape.

12

Page 13: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Relationship - Example

• For example in our Premiere Database again we have this relationships among entities:

13

represents CustomerSales Rep

Order

has

Could be read as : A Sales RepRepresents a Customer. And aCustomer has an Order.

Page 14: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Cardinality

• Cardinality: number of items that must be included in a relationship– An entity in a relationship with minimum cardinality of

zero plays an optional role in the relationship– An entity with a minimum cardinality of one plays a

mandatory role in the relationship

14

Page 15: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Cardinality - Symbols

15

One-is-to-many Relationship

1 M

M N

Many-to-many Relationship

Page 16: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Cardinality Symbols - Example

16

represents CustomerSales Rep

Could be read as : A Sales Rep could represent1 or Many Customers.

1 M

Page 17: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Cardinality Symbols – Example (Cont’d)

17

has PartsOrder

Could be read as : An Order could have many Parts (e.g. ProductsOrdered) and a Part could have many Orders.

M N

Page 18: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Degree of Relationship

• There are three Degree of Relationships in ERD notation, namely:– Unary– Binary– Ternary

18

Page 19: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Degree of Relationship (Cont’d)

19

Unary

Binary

Ternary

Page 20: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Degree of Relationship (Cont’d)

20

Employee

Unary

Customer Orders Binary

Vendor Warehouse

Part

Ternary

Manages

makes

supplies

Page 21: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Attribute

• Refers to the characteristic or basic fact or field of an Entity or Relationship.

• For example a Student entity could have the following attributes ID Number, Last Name, First Name, Address, Birth Date etc.

• A relationship could also have an attribute for example an Entity name Student enrolls (relationship) to a Course/Program. Now, when you enroll you enroll on a certain date so you will have an attribute of Enrollment Date under Enroll relationship.

• It is normally represented by an oval.

21

Page 22: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Attribute - Example

22

RepNum

Sales Rep

LastnameFirstname

Street

City

State

Zip CommissionRate

Take note thata Primary Keyis underlined.

Page 23: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Attribute – More Example

23

RepNum

Sales Rep

LastnameFirstname

Street

City

State

Zip CommissionRate

Customerrepresents

CustomerNum

CustomerName

CreditLimit

Balance

Street

City

State

Zip

1 M

Page 24: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Crow’s Foot notation - Symbol

24

Entity name

Attribute 1Attribute 2Attribute 3Attribute 4

Page 25: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Crow’s Foot notation - Example

25

Student

StudentIDFirstnameLastnameGenderProgram

Entity

Attributes

Page 26: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Crow’s Foot notation - Keys

26

Student

StudentID (PK)FirstnameLastnameGenderProgramID (FK)

PK – Primary Key

FK – Foreign Key

Page 27: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Crow’s Foot Cardinality - Symbols

27

One and only one included in the relationship

Zero or many could be included in the relationship. This is optional mode.

One or many could be included in the relationship.This is mandatory mode.

Page 28: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Crow’s Foot notation – with Cardinality

28

Rep

Repnum (PK)FirstnameLastnameCommissionRate

Customer

Customernum(PK)CustomernameStreetCityStateZipBalanceCreditLimitRepnum (FK)

Page 29: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Non-Graded Seatwork

29

• Using Premier Database– Create a Chen notation on at least two tables that is not

part of our example and tables that has relationship– Create a Crow’s Foot notation on at least two tables that

is not part of our example and tables that has relationship

Page 30: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

Graded Seatwork

30

• Create both Chen and Crow’s foot notation on all tables and relationship

– Alexamara Marina– Henry Books

Page 31: Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model

End

31