Question: SQL question Consider the following relational schema. Emp(eid integer, ename: string, age: integer, salary: real) Works (eid: integer, did: integer, pet-time: integer) Dept (did: integer,

SQL question

SQL question Consider the following relational schema. Emp(eid integer, ename: string, age:

Consider the following relational schema. Emp(eid integer, ename: string, age: integer, salary: real) Works (eid: integer, did: integer, pet-time: integer) Dept (did: integer, dname: string, budget: real, managerid: integer) Note that a manager is an employee as well and their manager id and employee id are the same. An employee can work in more than one department. The pet time field of the Works relation shows the percentage of time that a given employee works in a given department. Formulate the following queries in SQL: Print the name of each employee whose salary exceeds the budget of all of the departments that he or she works in Find the managerids of managers who manage only departments with budgets greater than $1 million Find the enames of managers who manage the departments with the largest budget Find the managerids of managers who control the largest amount of total budget. As an example, if a manager manages two departments, the amount of total budget for him will be the sum of budgets of two departments. We want to find managers that have max total budget

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!