SQL Discussion
SQL - Discussion – Question
Part A.
Formulate the following queries:
1, List the name of project that has MOST of employees working on it. (hint: use group by and having with subquery )
2. List the name of division that has more employees whose salary is above the divisional average salary than any other divisions.
3. Increase the salary of division manager by 1% if he/she works on other division's project (hint: need a co-related condition )
4. List the total number of employees from Chen's division who work with Chen on project development. (note if a Chen's divisional colleague works on more than one projects with Chen, this colleague should be only count once.
5. For each project, list the name of project, and (1) the total number of employee working on it, (2 )the total number of employees who work on it but from other division (not the division that sponsors this project), and (3) the total number of employee who work on it and are from the same division that sponsors this project. Hint, the structure of your code is as follows
Select pname ,
(a select statement that returns data in (1)) total,
( a select statement that returns data in (2)) outsiders,
(a select statement that returns data in (3)) insiders
From Project