针对【查询每个部门的平均工资】的问题,书中答案错误。在这里给出我的代码。 select dept_name, avg(salary) as avg_salary from salaries join dept_emp on salaries.emp_no=dept_emp.emp_no and salaries.from_date>=dept_emp.from_date and salaries.to_date<=adddate(date_format(adddate(dept_emp.to_date, interval 1 month), '%Y-%m-01'), interval -1 day) join departments as dept on dept_emp.dept_no=dept.dept_no group by dept.dept_no order by avg_salary desc; 下面是查询结果:
针对【查询每个部门的平均工资】的问题,书中答案错误。在这里给出我的代码。

select dept_name, avg(salary) as avg_salary from salaries join dept_emp on salaries.emp_no=dept_emp.emp_no and salaries.from_date>=dept_emp.from_date and salaries.to_date<=adddate(date_format(adddate(dept_emp.to_date, interval 1 month), '%Y-%m-01'), interval -1 day) join departments as dept on dept_emp.dept_no=dept.dept_no group by dept.dept_no order by avg_salary desc;
下面是查询结果:
原文:
页面入口:http://www.broadview.com.cn/book/35010
原链接地址已不存在,新的有效连接应为:
页面入口:http://www.broadview.com.cn/book/5261
原文:
Mysql_upgrade检查所有数据库…
应为:
mysql_upgrade检查所有数据库…
由于MVCC,返回了3行
这里应该是返回“2”行。同理,该页第24行,返回的不是4行,应该是“3”行
原文:
摘自MySQL文档,https://dev.mysql.com/doc/refman/8.0/en/altertable.html
应为:
摘自MySQL文档,https://dev.mysql.com/doc/refman/8.0/en/alter-table.html