Upload
mark-smith
View
214
Download
1
Embed Size (px)
Citation preview
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.
Nouns = possible data items
(only the first occurrence is highlighted)
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.
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.
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
Data Items Found(= Entities or Attributes)
department
(department) name
(department) main office
employee
(department) manager
date started managing department
offices
(office) building
(office) room
(office) telephone
project
(project) number
(project) description
(project) budget
(project) director
(employee) name
social security number
address
salary
sex
birthdate
starting date (of employment)
number of hours worked
Verb phrases = possible relationships
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.
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.
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
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
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.
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
projects are controlled by departments
employee worked on a project
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
Draw Entities
EMPLOYEE
EMPLOYEESSN
EMPLOYEESSN
Name
EMPLOYEE
Address
SSN
Name
EMPLOYEE
Address Salary
SSN
Name
EMPLOYEE
Address SalarySex
SSN
Name
EMPLOYEE
Address SalarySex
BirthdateSSN
Name
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
DEPARTMENT
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
DEPARTMENTName
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
DEPARTMENTName
Main Office
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
DEPARTMENTName
Main Office
Building
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
DEPARTMENTName
Main Office
Building Room
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
DEPARTMENTName
Main Office
Building Room Phone
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
DEPARTMENTName
Main Office
Building Room Phone
Office
Building Room Phone
EMPLOYEE
Address SalarySex
BirthdateSSN
StartdateName
DEPARTMENTName
Main Office
Building Room Phone
Office
Building Room Phone
PROJECT
PROJECTNumber
PROJECT
Description
Number
PROJECT
Description
BudgetNumber
Draw Relationships
(attributes are omitted for clarity)
BelongsTo
EMPLOYEE DEPARTMENT
BelongsTo
EMPLOYEE DEPARTMENTManages
BelongsTo
EMPLOYEE DEPARTMENTManages
StartDate
BelongsTo
EMPLOYEE DEPARTMENT
PROJECT
Manages
StartDate Controls
BelongsTo
EMPLOYEE DEPARTMENT
PROJECT
Manages
StartDate
Directs
Controls
BelongsTo
EMPLOYEE DEPARTMENT
PROJECT
Manages
StartDate
WorksOn
Controls
Directs
BelongsTo
EMPLOYEE DEPARTMENT
PROJECT
Manages
StartDate
WorksOn
Controls
Hours Directs
Specify Attributes and Domains
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
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