Question: USING ORACLE 1. Create a table for this activity 2. Within the Employees table, each manager_id is the manager of one or more employees
USING ORACLE 1. Create a table for this activity 2. Within the Employees table, each manager_id is the manager of one or more employees who each have a job_id and earn a salary. For each manager, what is the total salary earned by all of the employees within each job_id? Write a query to display the Manag-er_id, job_id, and total salary. Include in the result the subtotal salary for each manager and a grand total of all salaries. 3. Amend the previous query to also include a subtotal salary for each job_id regardless of the manager_id. 4. Using GROUPING SETS, write a query to show the following groupings: department_id, manager_id, job_id manager_id, job_id. department_id, manager_id 5. Execute this Grouping Functions and give the results: SELECT department_id, job_id, SUM(salary), GROUPING(department_id) AS "Dept sub total", GROUPING(job_id) AS "Job sub total" FROM tbl employees WHERE department_id < 50 GROUP BY CUBE (department_id, job_id)
Step by Step Solution
3.43 Rating (150 Votes )
There are 3 Steps involved in it
Step 1 Create an Employees Table You can create the Employees table using the following SQL statement sql CREATE TABLE Employees employeeid NUMBER PRI... View full answer
Get step-by-step solutions from verified subject matter experts
