01_1_Introduction_databases_Ex.docx
01_1_Introduction_databases_Ex.docx
Exercise 1
In the information requirement below, you can see which employees are
working on which projects and how many hours they have already spent
per project.
Exercise 2
EMPLOYEES= (teacher_id,last_name,first_name,birth_date,degree,
Function_code)
The EMPLOYEES table lists the staff members within the college. These
employees may be lecturers, coordinators, heads of training, heads of ICT
services, deputy heads of departments or heads of departments. An
employee has only one function within the college. So, for example, a
lecturer cannot be a coordinator.
The COURSES table lists the courses taught within the college.
Exercise 3
a. In the tables of the database below, designate the primary keys
(PK). Also designate the foreign keys (FK) and indicate what they
refer to.
b. draw the ERD.
Database PROJECTS
The PROJECTS table contains projects that are either developed internally
for the company or are performed for external customers.
Project_id : identification of the project
start_date : date when the project is started
end_date : day following the date when the project ends.
responsible_dept : code of the department responsible for the
implementation of the project
sponsor_dept : code of the department responsible for the
financing of the project
budget : budgeted costs for the project
description : Short description of the project
The ASSIGNMENTS table shows the composition of the project groups.
This also includes the period of time the employee will be involved in the
project.
Project_id : identification of the project
Employee_id : identification of the employee
task : the function that the employee performs within the
project
start_date : first day of the period in which the employee is working
on the project
end_date : day following the last working day of the employee on
this project, as long as an employee is still collaborating
on a project, end date is not filled in!
An employee can be involved in multiple project groups.
In each project group, he/she can only do one task.
The TIMESHEETS table contains time sheets that record how many hours
a particular employee spent on a particular project on a particular date.
Only if the hours have been performed, a row is added to this table.
Note : no overtime can be recorded if no hours have been worked.
Work_date : date the work was performed
hours : Number of hours and minutes spent during normal working
hours
overtime : Number of hours and minutes spent outside normal working
hours
Per day, an employee can complete only one time sheet for a given
project.
Exercise 4
a. In the tables of the database below, designate the primary keys (PK).
Also designate the foreign keys (FK) and indicate what they refer to.
b. Draw the ERD of this database.
Database COURSES
GRADES = (grade_id,lower_limit,upper_limit)
COURSES = (course_id,course_description,type,duration)
This table lists all the projects carried out by the company.
Each project has a unique project number .
A project has a particular location and is monitored by a particular department.
DEPARTMENT_ID is a foreign key to DEPARTMENT_ID of the table
DEPARTMENTS.
This table keeps track of which employee is working on which project and how
many hours they have already spent on the project.
Since an employee can work on multiple projects, the primary key of this table
consists of the combination EMPLOYEE_ID and PROJECT_ID.
EMPLOYEE_ID is foreign key to EMPLOYEE_ID from EMPLOYEES and PROJECT_ID
is foreign key to PROJECT_ID from PROJECTS.
The table FAMILY_MEMBERS
Requested:
a. Indicate the PK and FKs for each table.
b. Set up the ERD from the enterprise database
c. Answer the questions below:
- Can a department be led by multiple department heads?
- Can an employee be assigned to multiple departments?
- Can there be a department without employees?
- Can there be a department without a department head?
- Can there be an employee without an assigned department?
- Can there be a manager without employees?
- Are there employees without a manager?
d. The contents of the table departments is currently as follows: