SELECT EMP_NO IN STEAD OF SELECT*
I replaced * by emp_no since we are only interested in employees no but not in all of their information, is it right this way???
select emp_no, avg(salary) from salaries
group by emp_no
Yes, this is also correct. Bravo!
Hope this helps.
I receive an error when using:
GROUP BY emp_no
HAVING AVG(salary) > 120000;
when I change the * for emp_no it runs fine.
Thanks for reaching out.
Could you please share with us a screenshot of the whole error message you've encountered? This can help us assist you better. Thank you.
Looking forward to your answer.
SELECT *, AVG(salary) FROM salaries GROUP BY emp_no HAVING AVG(salary) > 120000 LIMIT 0, 1000
Error Code: 1055. Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'employees.salaries.salary' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by