Data Modeling and Database Administration
Final Exam Problems
1. Create a database for the XYZ Consultancy Company. Name the Jobs.
2. Create the following 4 tables in the Jobs database: department, employee,
project, and works-on. In the entity models that define the tables, the
underlined attributes are the primary keys.
The department table represents all departments of the company. Each
department has the following attributes:
department (dept_no, dept_name, location)
dept_no, which is a primary key, represents the unique number of each
department, dept_name is the name of each department, and location is the
location of the corresponding department.
The employee table represents all employees working for the company. Each
employee has the following attributes:
employee (emp_no, emp_fname, emp_lname, dept_no)
emp_no is a primary key and represents the unique number of each
employee. emp_fname and emp_lname are the first name and last name of each
employee, respectively. Finally, dept_no, should be defined as a foreign key. It is
the number of the department to which the employee belongs.
Each project of the company is represented in the project table. This table has
the following columns:
project (project_no, project_name, budget)
project_no (the primary key) represents the unique number of each
project. project_name and budget specify the name and the budget of each
project, respectively.
1
The works_on table specifies the relationship between employees and projects.
It has the following columns:
works_on (emp_no, project_no, job, enter_date)
emp_no, a foreign key referencing the employee table, specifies the employee
number and project_no, a foreign key referencing the project table, specifies the
number of the project on which the employee works. In addition to being
individual foreign keys, they should together be defined as composite primary
key. This would ensure that the combination of data values belonging to these
two columns will always be unique. job and enter_date specify the task and the
starting date of an employee in the corresponding project, respectively.
3. Create a nonclustered index for the enter_date column of the works_on
table.
4. How can you drop the index that is implicitly created for the primary key of
a table? Hint: do some research for this. We did not treat it in class.