Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given the following database schema. An employee can work in multiple departments. The percent attribute in WorksIn specifies how much time the employee

image text in transcribed

You are given the following database schema. An employee can work in multiple departments. The percent attribute in WorksIn specifies how much time the employee works in that department. Assume that managerID is a foreign key from another table. Be careful with ambiguity of the name attribute. Employee(employeeID: integer, name: string, age: integer, salary: real) WorksIn(employeeID: integer, departmentID:integer, percent: integer) Department(departmentID: integer, name: string, budget: real, managerID, integer) Write SQL queries for the following (10 points each): 1. Return the managerID for all departments where the budget is at least $2,000,000. 2. Return the names of all employees who work in at least two departments. 3. Return the names of managers who manage the department(s) with the smallest budget(s). Note that the managerID is a manager's employeeID. 4. Find the managerID of all managers who manager more than $20,000,000. Note that a manager who manages multiple departments manages the sum of the budgets from those departments. 5. Print the min, max, and average age of the employees in each department. Your results should be grouped by department

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions