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, 21.06.2019 19:30
Entering key dates from your course syllabi test and quiz dates, assignments due dates in your planner can you manage your schedule by allowing you to see commitments ahead of time.
Answers: 3
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
question
Computers and Technology, 23.06.2019 23:30
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
question
Computers and Technology, 24.06.2019 10:20
Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should not be added to the list). these values entered by the user are added to a list we call 'initial_list'. then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. finally, inside print out all of the values in the new list. for example: input: enter value to be added to list: a enter value to be added to list: b enter value to be added to list: c enter value to be added to list: exit output: a b c a b c a b c note how 'exit' is not added to the list. also, your program needs to be able to handle any variation of 'exit' such as 'exit', 'exit' etc. and treat them all as 'exit'.
Answers: 2
You know the right answer?
Consider the following relational schema. An employee can work in more than one department; the pct_...
Questions
question
English, 06.08.2021 14:00
question
English, 06.08.2021 14:00
question
Mathematics, 06.08.2021 14:00
question
Mathematics, 06.08.2021 14:00
question
Arts, 06.08.2021 14:00
question
History, 06.08.2021 14:00
Questions on the website: 13722363