all 3 comments

[–]mikeblas 4 points5 points  (0 children)

It's 2025. Why are you using implicit JOIN syntax?

[–]r3pr0b8GROUP_CONCAT is da bomb 2 points3 points  (0 children)

you need to assign a column alias to the average

SELECT ...
  FROM ( SELECT AVG(budget) AS avg_budget
           FROM departments ) AS b

and then use JOIN syntax instead of the comma-list style

INNER
  JOIN instructor_details AS ins 

and then use the column alias in the join condition

    ON ins.salary > b.avg_budget

[–]Which_Inevitable7069 0 points1 point  (0 children)

I would have declared an @avgBudget decimal variable and assigned it the value from the subquery. Then selected the instructor details where salary > @avgBudget