0% found this document useful (0 votes)
40 views2 pages

XDCCSC CDC

The document provides instructions for creating a database schema for a company called XYZ Consultancy. It describes creating four tables - department, employee, project, and works-on. It specifies the attributes and primary keys for each table. It also describes creating a foreign key relationship between employee and department tables and a composite primary key for the works-on table using the emp_no and project_no attributes. Finally, it asks how to drop an index implicitly created for a primary key.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

XDCCSC CDC

The document provides instructions for creating a database schema for a company called XYZ Consultancy. It describes creating four tables - department, employee, project, and works-on. It specifies the attributes and primary keys for each table. It also describes creating a foreign key relationship between employee and department tables and a composite primary key for the works-on table using the emp_no and project_no attributes. Finally, it asks how to drop an index implicitly created for a primary key.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

You might also like