subject

Consider the following relational schema. 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, budget: real, managerid: integer)

In the above, please note that there is an attribute pcttime (of Integer type) in the Works table, as the schema shows. A tuple/row <1, 1, 50> in the Works Table indicates that the Employee 1 works in Department 1 with 50% of time, which is PART TIME. Another tuple/row <2, 2, 90> in the Works Table indicates that the Employee 2 works in Department 2 with 80% of time, which is also PART TIME. Finally, a tuple/row <3, 5, 100> in the Works Table indicates that the Employee 3 works in Department 5 with 100% of time, which is FULL TIME. The number of FULL-TIME EQUIVALENT employees within a department is calculated based on the TOTAL PCTTIME of ALL employees in the department.

Please also note that a department with eighteen full-time employees and five 50% parttime employees is considered as having 18*100%+5*50% = 20.5 FULL-TIME EQUIVALENT employees, and thus should be included in the result with 23 (i. e., 18+5) as the ACTUAL number of employees in the department.

Write the following queries in SQL:

1. Find the name, age and salary of the oldest employee in each department.
2. Find the employees who is younger than all managers.

3. Find the names, age and salary of each employee who works in the Sales Department but not in Marketing department (assume that Sales Dept ID = 4 and Marketing Dept ID = 6).

4. Find the department(s) with the highest average salary of employees.
5. Find the managers who also work in another department (or other departments) but not as a manager there.
6. Find the employee ID, name and age of each employee whose salary exceeds the budget of every department that he or she works in.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:00
Write a method so that the main() code below can be replaced by the simpler code that calls method original main(): public class calcmiles { public static void main(string [] args) { double milesperhour; double minutestraveled; double hourstraveled; double milestraveled; milesprhour = scnr.nextdouble(); minutestraveled = scnr.nextdouble(); hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; system.out.println("miles: " + milestraveled); } }
Answers: 2
question
Computers and Technology, 23.06.2019 01:10
Are special combinations of keys that tell a computer to perform a command. keypads multi-keys combinations shortcuts
Answers: 1
question
Computers and Technology, 23.06.2019 05:00
Which best explains why a digital leader would join a society specializing in technology
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
What are three software programs for mobile computing?
Answers: 1
You know the right answer?
Consider the following relational schema. An employee can work in more than one department; the pct_...
Questions
question
Mathematics, 08.07.2021 06:50
question
Mathematics, 08.07.2021 06:50
Questions on the website: 13722361