Question: 5 - Based on the below relational schema, answer the following questions. ( 2 0 pts ) Emp ( empid: integer, empname: string, age: integer,

5- Based on the below relational schema, answer the following questions. (20 pts)
Emp(empid: integer, empname: string, age: integer, salary: real)
Works(empid: integer, deptid: integer, pcttime: integer)
Dept(deptid: integer, deptname: string, budget: real, managerid: integer)
a. Identify a foreign key involving the Dept relation. Discuss how this constraint can be
enforced when trying to delete a Dept tuple.
b. Provide the SQL statements to create the relations mentioned above, ensuring to
include necessary primary and foreign key constraints.
c. How would you define the Dept relation in SQL to ensure each department always
has a manager?
d. Write an SQL statement to add an employee named your name with empid as your
student ID and age as your own (or a random!) age and salary of $71,000.(important
to user your real name and student id)
e. Write an SQL statement that applies a 9% salary increase to every employee. (with
UPDATE TABLE query)
f. Write an SQL statement for removing a department named 'IT'. Discuss the
consequences of this action given your schema's referential integrity constraints.
 5- Based on the below relational schema, answer the following questions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!