Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following relations. An employee can work in more than one department; the pct time field of the Works relation shows the percentage of

Consider the following relations. 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.

Emp(eid: integer, ename: string, age: integer, salary: real) Works(eid: integer, did: integer, pct_time: integer) Dept(did: integer, dname: string, budget: real, managerid: integer)

Write and execute the following queries in SQL:

1. Print the names and ages of each employee who works in the Hardware department.

2. For each department with more than 20 employees, print the did together with the number of employees that work in that department.

3. Print the name of each employee whose salary exceeds the average salary of all employees.

4. Find the managerids of managers who manage only departments with budgets greater than $1 million.

5. Find the employees who work in the Operations department and print the information (eid, ename, age, and salary) for each employee. The output should be ordered by ename.

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

=+ What are the undesirable consequences?

Answered: 1 week ago