0 votes 0 votes Databases sql + – Anand Yadav asked Oct 17, 2018 Anand Yadav 425 views answer comment Share Follow See 1 comment See all 1 1 comment reply Shaik Masthan commented Oct 17, 2018 reply Follow Share select emp_name from EMP as EMP1 where salary > ( select avg(salary) from EMP as EMP2 ); 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Sql query will be: Select emp_name from Emp E1(Select dept_name,AVG(Salary) as A from Emp E2 Group by(dept_name)) where E1.salary>E2.A and E1.dept_name=E2.dept_name. raahul answered Oct 17, 2018 • edited Oct 18, 2018 by raahul raahul comment Share Follow See all 2 Comments See all 2 2 Comments reply aambazinga commented Oct 18, 2018 reply Follow Share in the where clause, it should be E1.dept_name=E2.dept_name, as table E2 has only two attributes, dept_name and A. 0 votes 0 votes raahul commented Oct 18, 2018 reply Follow Share Yaa..got it.Thanks :) 0 votes 0 votes Please log in or register to add a comment.