►Title:
Oracle With clause
►Content:
Oracle With clause | Oracle SQL WITH Clause | How to write Oracle SQL Queries using WITH Clause
Example:
with
dept_costs AS (
select d.DEPARTMENT_NAME,SUM(e.SALARY) as Dept_Total_Salary
from EMPLOYEES e
join DEPARTMENTS d on d.DEPARTMENT_ID=e.DEPARTMENT_ID
group by d.DEPARTMENT_NAME
order by d.DEPARTMENT_NAME ASC
),
avg_cost AS (
select sum(Dept_Total_Salary) dividedBy count(*) AS dept_avg
from dept_costs)
select *
from dept_costs
where Dept_Total_Salary greater than (
select dept_avg
from avg_cost
)
order by DEPARTMENT_NAME;
🔗LINKS🔗
Website: http://rejawebs.com/#/
LinkedIn: / md-rezoyanul-islam-096a3775
►►► Find me on Social Media◄◄◄
Facebook: / rezoyanul.reza
✉ Contact with me
Email: mailto:[email protected]
❤ Make sure you SUBSCRIBE and be the 1st one to view newly created videos!