49
The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the department. We should keep track of the date when that person started managing the department. We should also keep track of all of the offices that are assigned to the department. Each office has a building name, room number and a telephone.

The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Embed Size (px)

Citation preview

Page 1: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the department. We should keep track of the date when that person started managing the department. We should also keep track of all of the offices that are assigned to the department. Each office has a building name, room number and a telephone.

Page 2: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Nouns = possible data items

(only the first occurrence is highlighted)

Page 3: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the department. We should keep track of the date when that person started managing the department. We should also keep track of all of the offices that are assigned to the department. Each office has a building name, room number and a telephone.

Page 4: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

A department controls a number of projects, each of which has a unique number within the company. Each project also has a description, employee who serves as its director, and budget. The company also wants to keep track of all employees who are assigned to each project.

Page 5: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

We want to keep track of each employee’s name. social security number, address, salary, sex, birthdate, and starting date of employment with the company. Each employee belongs to a department but may work on projects that are controlled by departments other than the one to which he or she is assigned. We also want to keep track of the number of hours each employee has worked on each project

Page 6: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Data Items Found(= Entities or Attributes)

department

(department) name

(department) main office

employee

(department) manager

date started managing department

offices

(office) building

Page 7: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

(office) room

(office) telephone

project

(project) number

(project) description

(project) budget

(project) director

Page 8: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

(employee) name

social security number

address

salary

sex

birthdate

starting date (of employment)

number of hours worked

Page 9: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Verb phrases = possible relationships

Page 10: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the department. We should keep track of the date when that person started managing the department. We should also keep track of all of the offices that are assigned to the department. Each office has a building name, room number and a telephone.

Page 11: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

A department controls a number of projects, each of which has a unique number within the company. Each project also has a description, employee who serves as its director, and budget. The company also wants to keep track of all employees who are assigned to each project.

Page 12: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

We want to keep track of each employee’s name, social security number, address, salary, sex, birthdate, and starting date of employment with the company. Each employee belongs to a department but may work on projects that are controlled by departments other than the one to which he or she is assigned. We also want to keep track of the number of hours each employee has worked on each project

Page 13: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

department has a name.

department has a main office.

employee manages a department

offices are assigned to a department

office has a building name

office has a room number

office has a telephone

Page 14: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

department controls a project

project has a unique number

project has a description

project has an employee

employee who serves as director

project has a budget

employee is assigned to a project.

Page 15: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

employee has a nameemployee has a social security numberemployee has a addressemployee has a salaryemployee has a sexemployee has a birthdateemployee has a starting date of employmentemployee belongs to a departmentemployee works on projects

Page 16: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

projects are controlled by departments

employee worked on a project

Page 17: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Modeling Principles:

• Use common form for all synonyms• nouns suggest either entities or attributes• possessive or“has a” often designates an attribute• other verb phrases often designate relationships

Page 18: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Draw Entities

Page 19: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Page 20: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEESSN

Page 21: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEESSN

Name

Page 22: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address

SSN

Name

Page 23: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address Salary

SSN

Name

Page 24: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

SSN

Name

Page 25: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

Name

Page 26: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

Page 27: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

DEPARTMENT

Page 28: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

DEPARTMENTName

Page 29: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

DEPARTMENTName

Main Office

Page 30: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

DEPARTMENTName

Main Office

Building

Page 31: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

DEPARTMENTName

Main Office

Building Room

Page 32: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

DEPARTMENTName

Main Office

Building Room Phone

Page 33: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

DEPARTMENTName

Main Office

Building Room Phone

Office

Building Room Phone

Page 34: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

EMPLOYEE

Address SalarySex

BirthdateSSN

StartdateName

DEPARTMENTName

Main Office

Building Room Phone

Office

Building Room Phone

Page 35: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

PROJECT

Page 36: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

PROJECTNumber

Page 37: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

PROJECT

Description

Number

Page 38: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

PROJECT

Description

BudgetNumber

Page 39: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Draw Relationships

(attributes are omitted for clarity)

Page 40: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

BelongsTo

EMPLOYEE DEPARTMENT

Page 41: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

BelongsTo

EMPLOYEE DEPARTMENTManages

Page 42: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

BelongsTo

EMPLOYEE DEPARTMENTManages

StartDate

Page 43: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

BelongsTo

EMPLOYEE DEPARTMENT

PROJECT

Manages

StartDate Controls

Page 44: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

BelongsTo

EMPLOYEE DEPARTMENT

PROJECT

Manages

StartDate

Directs

Controls

Page 45: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

BelongsTo

EMPLOYEE DEPARTMENT

PROJECT

Manages

StartDate

WorksOn

Controls

Directs

Page 46: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

BelongsTo

EMPLOYEE DEPARTMENT

PROJECT

Manages

StartDate

WorksOn

Controls

Hours Directs

Page 47: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Specify Attributes and Domains

Page 48: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Attribute Domain Data Type Constraints

Employee.Name EmpNameDom String Max length 40

SSN SSNDom String ###-##-####

Address AddressDom String Max length 60

Salary Integer 0

Sex {M,F}

Birthdate Date

Employee.Startdate Date

Department.Name DeptNameDom String Max length 15

MainOffice OfficeDom (Building, Room, Phone)

Office Set of OfficeDom

Building BuildingDom String Max length 10

Room RoomDom String Max length 3

Page 49: The company is organized into departments and each department has a unique name and main office. The department has a particular employee who manages the

Attribute Domain Data Type Constraints

Phone PhoneDom String ###-###-####

Number ProjectNumDom Integer 0

Description ProjDescDom String Max length 40

Budget Integer

Manager.StartDate Date

WorksOn.Hours Integer 0