Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Consider the following relational schema: Employee (eid: integer, ename: string, age: integer, salary: real) Department(did: integer, dname: string, budget: real, mgrid: integer) Works(eid: integer,

image text in transcribed

2. Consider the following relational schema: Employee (eid: integer, ename: string, age: integer, salary: real) Department(did: integer, dname: string, budget: real, mgrid: integer) Works(eid: integer, did: integer, pct_time: integer) An employee can work in more than one department; the pct_time field of the Works relation shows the percentage of time that a given employee works in a given department. a) (15 pts.) Write an SQL query to find the IDs of mangers who control the largest amounts. (Hint: Create a table in the WHERE clause to compute the total budget for each manager) ) (as pts.) Write an SQL trigger to express the following constraint: "Whenever an employee is given a raise, the manager's salary must be increased to be at least as much." (increasing a manager's salary to be equal to the employee who received the raise, if the manager's salary is less than the employee's new salary)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions