database design principles – lecture 3 conceptual database design – identifying entities

24
Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

Upload: nathaniel-holt

Post on 02-Jan-2016

261 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

Database Design Principles – Lecture 3

Conceptual Database Design – identifying entities

Page 2: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

2

Lecture Objectives Discovering Entities

Page 3: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

3

Discovering Entities

Using a top down approach, identify the major ‘things’ a business needs to store information about == entities

Document these in a conceptual model Model will show the following:

Entity – something about which someone wants to store data; typically a person, a place, a thing, a concept, or an event

Page 4: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

4

Discovering Entities

Requirements gathering – focusing on data: Interview end users Review existing documentation (forms,

reports) Brainstorming Overview of the business Questionnaires Review system documentation

Functional/non-functional requirements Work flow diagrams Data flow diagrams Use case descriptions

Page 5: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

5

Discovering Entities

Use a technique like ‘noun filtering’ Look for nouns that describe data Similar nouns can be grouped into an

entity Some nouns will become attributes

Page 6: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

6

Discovering Entities

Generally, nouns translate into entities

Plan Client

Page 7: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

7

Sample Conceptual Model - ERD

This is a preliminary conceptual model. Model shows entities without attributes or

relationships.

Page 8: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

8

Entity

Corresponds to a table and not to a row in the relational environment

Can be strong or weak Entity name is a noun

Page 9: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

9

Entity can be strong or weak Strong Entity (existence

independent) Does not depend on the existence of some other entity to exist Each entity occurrence of a strong entity is uniquelyidentifiable using the primary key attributes of that entity type

Can identify each Plan based on a plan code and can identify each Client by a client code. Therefore, both are strong entities.

Entity

Plan ClientWeak relationship (non-identifying)

Page 10: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

10

Entity

Entity can be strong or weak Weak Entity (existence

dependent) Does depend on the existence of some other entity in order to exist Cannot identify each occurrence of the Dependent. We can onlyIdentify the Dependent byKnowing the Parent,through the primarykey of the Parent.

PARENT DEPENDENT

Can identify each parent based on a primary key (therefore it is a strong entity type) and can only identify each dependent only by knowing the Parent. Therefore dependent is a weak entity.

Page 11: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

11

Discovering Relationships

Verbs translate into relationships among entities

Relationships are bi-directional Need to know the following:

Optionality Cardinality

Page 12: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

12

Relationship Participation

Optional participation One entity occurrence does not require

corresponding entity occurrence in particular relationship

Mandatory participation One entity occurrence requires

corresponding entity occurrence in particular relationship

Page 13: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

13

Relationship Participation

Page 14: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

14

Relationship Participation

Page 15: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

15

The Entity Relationship Model

Widely accepted and adapted graphical tool for data modeling

Introduced by Chen in 1976 Graphical representation of entities and

their relationships in a database structure

Page 16: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

16

The Entity Relationship Model

Page 17: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

17

The Entity Relationship Model

Page 18: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

18

In Summary

Steps to create a conceptual model Identify entities Identify relationships between entities

taking into consideration the business rules

Page 19: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

19

Discovering Business Rules

Constrain some part of the business

For example: An employee can only choose one

benefit plan An employee may or may not have

dependents An employee may opt out of a benefit

Page 20: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

20

Discovering Business Rules

Sources of Business Rules: Company managers Policy makers Department managers Written documentation

Procedures Standards Operations manuals

Direct interviews with end users

Page 21: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

21

Summary

Entity relationship (ER) model Uses ERD to represent conceptual database as

viewed by end user ERD’s main components:

Entities Relationships

Includes connectivity and cardinality notations Connectivities and cardinalities are based on

business rules In ERD, M:N relationship is valid at conceptual

level

Page 22: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

22

Create an ERD for the following:

A department employs many employees, but each employee is employed by one department.

A division operates many departments, but each department is operated by one division.

An employee may be assigned to many projects, and a project may have many employees assigned to it.

Page 23: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

23

Create an ERD for the following: Identify the entities Draw the ERD showing relationships

A Librarian wishes to make inquiries about borrowing activity within a library. The librarian can inquire about specific books borrowed by a customer using either their account or name. An inquiry can also be made by book category (such as fantasy, children’s, reference, etc) or an inquiry can be made that will look at the titles of a specific book.

Page 24: Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities

24

Create an ERD for the following: Identify the entities Draw the ERD showing relationships

Multiple Real Estate Listing Service (MRELS) is a company that has offices throughout Southern Ontario. These offices have a number of Real Estate agents working for them. MRELS deals in both residential and commercial real estate. Agents work with customers to get a listing or to find a listing for a customer. A listing will include the address and the type of property (residential or commercial), square footage, annual taxes and closing date. If it is a residential property, it will include number of bedrooms, number of bathrooms, special features (central air, heated by gas or oil, radiators or forced air, for instance). For a commercial property, it will include number of offices as well as number of docking bays (where trucks back up to be loaded/unloaded).