Error with the codes provided in the lectures
Hi,
I copied the following codes from the exercise regarding the HAVING lecture:
SELECT
*, AVG(salary)
FROM
salaries
WHERE
salary > 120000
GROUP BY emp_no
ORDER BY emp_no;
SELECT
*, AVG(salary)
FROM
salaries
GROUP BY emp_no
HAVING AVG(salary) > 120000;
However, when I run them through MySQL it gives me an error:
"Error code 1055: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated columns 'employes.salaries.salary' which is not functionally dependent on columns in GROUP BY clause, this is incompatible with sql_mode=only_full_group_by"
Please help.
1 answers ( 0 marked as helpful)
Hi Lisa!
Thanks for reaching out and letting us know you encounter error code 1055 at this stage of the course.
We have addressed this issue later. Please refer to the following lecture and then retry running your queries. https://learn.365datascience.com/courses/sql/introduction-to-joins
Hope this helps.
Best,
Martin