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

Post on 02-Jan-2016

256 views 6 download

Tags:

Transcript of Database Design Principles – Lecture 3 Conceptual Database Design – identifying entities.

Database Design Principles – Lecture 3

Conceptual Database Design – identifying entities

2

Lecture Objectives Discovering 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

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

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

6

Discovering Entities

Generally, nouns translate into entities

Plan Client

7

Sample Conceptual Model - ERD

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

relationships.

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

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)

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.

11

Discovering Relationships

Verbs translate into relationships among entities

Relationships are bi-directional Need to know the following:

Optionality Cardinality

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

13

Relationship Participation

14

Relationship Participation

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

16

The Entity Relationship Model

17

The Entity Relationship Model

18

In Summary

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

taking into consideration the business rules

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

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

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

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.

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.

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).