PrepAway - Latest Free Exam Questions & Answers

How will you design the database so that you can query the last increment given to a particular employee?

You have created a database for employee management. The database has a table named
Employees. The table has the following attributes:
Name
Address
Contact Number
Designation
You want to store the salary information for each employee. The database should also store salary
history. How will you design the database so that you can query the last increment given to a
particular employee?

PrepAway - Latest Free Exam Questions & Answers

A.
Create a new table that includes the EmployeeSalary and DateOfIncrement columns. Create a
one-to-one relationship with the Employees table.

B.
Create a new table that includes the EmployeeID, EmployeeSalary, and DateOfIncrement columns.
Create a one-to-many relationship with the Employees table.

C.
Add the EmployeeSalary and DateOfIncrement columns to the Employees table.

D.
Create a new table that includes the EmployeeSalary and DateOfIncrement columns. Create a
many-to-many relationship with the Employees table using the new table.

Explanation:
It is stated in the question that the database should contain salary history information. This means
that the salary of an employee can be incremented more than once, i.e. a one-to-many relationship
exists. To create a one-to-many relationship between salary and employee, you
have to create a separate entity for salary, and create a foreign key referring to the primary key of
the Employees table.
Answer C is incorrect. The creation of the DateOfIncrement column in the table will lead to
redundant data.


Leave a Reply