1426357293.3273chapter 2 In-Class Exercises
1426357293.3273chapter 2 In-Class Exercises
Chapter 2 Exercises
Page 1
Scenario #1
The entity type STUDENT has the following
attributes: student-name, address, hair-color,
phone, age, activity, and number-of-years.
Activity represents some campus-based
student activity, and number-of-years
represents the number of years the student
has engaged in this activity.
A given student may engage in more than one
activity.
Chapter 2 Exercises
Page 2
Student
Simple attributes
student-name
Multi-valued attribute
address
hair-color
{ phone }
age
{ activity-history ( activity-name, number-of-years ) }
Composite attribute
Chapter 2 Exercises
Page 3
Scenario #2
A company has a number of employees. The attributes of
EMPLOYEE include Emp_ID (identifier), Name, Address, and
Birthdate.
The company also has several projects. Attributes of PROJECT
include Proj_ID (identifier), Proj_Name, and Start_Date.
Each employee may be assigned to one or more projects, or may
not be assigned to any project.
A project must have at least one employee assigned to it, and
may have any number of employees assigned to it.
An employees billing rate may vary by project, and the
company wishes to record the billing rate (Billing_Rate) for
each employee when assigned to a particular project.
Chapter 2 Exercises
Page 4
Project
employee-id
emp-name
address
birthdate
Mandatory
participation.
Every project must
have an employee .
project-id
project-name
start-date
Optional
participation.
Not every
employee works on
a project.
Chapter 2 Exercises
Page 5
Scenario #3
A university has a large number of courses in its
catalog.
Attributes of COURSE include Course-number
(identifier), Course-Name, and credit-hours.
Each course may have one or more different courses
as prerequisites, or may have no prerequisites.
Similarly, a particular course may be a prerequisite for
any number of courses, or may not be a prerequisite
for any other course.
Chapter 2 Exercises
Page 6
Course
course-number
course-name
credit-hours
is-a prerequisite
Chapter 2 Exercises
has-a prerequisite
Page 7
Scenario #4
A university course may have one or more
scheduled sections, or it may not have a
scheduled section.
Attributes of COURSE include Course_ID
(identifier), Course_Name, and Credit_Hrs.
Attributes
of
SECTION
include
Section_Number
as
identifier
and
Semester_ID. Semester_ID is composed of
two parts: Semester and Year.
Chapter 2 Exercises
Page 8
Section
has
course-id
course-name
credit-hours
section-number
semester-id (semester, year)
Chapter 2 Exercises
Page 9
Section
has
course-id
course-name
credit-hours
section-number
semester-id (semester, year)
Instructor
instructor-id
instructor-name
office-number
department
Chapter 2 Exercises
teaches
Page 10
Scenario #5
A laboratory has several chemists who work on one or more projects.
Chemists may also use certain kinds of equipment on each project.
Attributes of CHEMIST include Employee_ID (identifier), Name, and
Phone_no.
Attributes of PROJECT include Project_ID (identifier) and Start_Date.
Attributes of EQUIPMENT include Serial_no. and Cost.
The organization wants to record Assign_Date that is, the date when
a give equipment item was assigned to a particular chemist working on
a specified project.
A chemist must be assigned to at least one project and one equipment
item.
A given piece of equipment need not be assigned, and a given project
need not be assigned either a chemist nor a piece of equipment.
Chapter 2 Exercises
Page 11
Chapter 2 Exercises
Page 12