Question: -- Rewrite this query without using the with construct. with dept_total(dept_name,value) as ( SELECT dept_name, sum (salary) from instructor group by dept_name), dept_total_avg(value ) as

-- Rewrite this query without using the with construct.

with dept_total(dept_name,value) as

(SELECT dept_name, sum(salary)

from instructor

group by dept_name),

dept_total_avg(value ) as

(select avg(value)

from dept_total)

select dept_name

FROM dept_total,dept_total_avg

where dept_total.value >= dept_total_avg.value;

select dept_total

from (

select dept_name, sum(salary) dept_total from instructor

group by dept_name

),(

select avg(dept_total) dept_total_avg from (

select dept_name, sum(salary) dept_total from instructor

group by dept_name

)

) where dept_total >= dept_total_avg;

I am using DBeaver and I keep getting an SQL error [1248] [42000]: Every derived table must have its own alias

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!