Uploaded by alabssi osama

4361927

advertisement
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 name
employee has a social security number
employee has a address
employee has a salary
employee has a sex
employee has a birthdate
employee has a starting date of employment
employee belongs to a department
employee 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
SSN
EMPLOYEE
SSN
Name
EMPLOYEE
Address
SSN
Name
EMPLOYEE
Address
SSN
Name
Salary
EMPLOYEE
Address
Salary
Sex
SSN
Name
EMPLOYEE
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Startdate
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Startdate
DEPARTMENT
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Name
Startdate
DEPARTMENT
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Startdate
Main Office
Name
DEPARTMENT
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Startdate
Building
Main Office
Name
DEPARTMENT
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Building
Startdate
Room
Main Office
Name
DEPARTMENT
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Building
Startdate
Room
Phone
Main Office
Name
DEPARTMENT
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Building
Startdate
Room
Phone
Main Office
Name
DEPARTMENT
Building
Room
Office
Phone
Address
Salary
Sex
SSN
EMPLOYEE
Birthdate
Name
Building
Startdate
Room
Phone
Main Office
Name
DEPARTMENT
Building
Room
Office
Phone
PROJECT
Number
PROJECT
Description
Number
PROJECT
Description
Number
PROJECT
Budget
Draw Relationships
(attributes are omitted for clarity)
BelongsTo
EMPLOYEE
DEPARTMENT
BelongsTo
EMPLOYEE
Manages
DEPARTMENT
BelongsTo
EMPLOYEE
Manages
DEPARTMENT
StartDate
BelongsTo
EMPLOYEE
Manages
DEPARTMENT
StartDate
Controls
PROJECT
BelongsTo
EMPLOYEE
Manages
DEPARTMENT
StartDate
Directs
Controls
PROJECT
BelongsTo
EMPLOYEE
Manages
DEPARTMENT
StartDate
Directs
WorksOn
Controls
PROJECT
BelongsTo
EMPLOYEE
Manages
DEPARTMENT
StartDate
Hours
WorksOn
Directs
Controls
PROJECT
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
MainOffice
OfficeDom
Office
String
(Building,
Room,
Phone)
Max length 15
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
Manager.StartDate
WorksOn.Hours
Integer
Date
Integer
0
Download