第一遍:
mysql> select 姓名 from employees-> where 编号 =-> (select 编号 from employees-> where 收入 =-> select 收入 -> from salary-> where 编号 = '4')-> and 收入 > max(收入 =-> select 收入-> from salary-> where 编号 = 1);
意识到子循环中括号没有加全。
第二遍:
mysql> select 姓名 from employees-> where 编号 =-> (select 编号 from employees-> where 收入 =-> (select 收入 -> from salary-> where 编号 = '4')-> and 收入 > max(收入 =-> (select 收入-> from salary-> where 编号 = 1)));1054 - Unknown column '收入' in 'where clause'
查询输入的表格错误,将employees 改为salary
第三遍:
mysql> select 姓名 from employees-> where 编号 =-> (select 编号 from salary-> where 收入 =-> (select 收入 -> from salary-> where 编号 = '4')-> and 收入 > max(收入 =-> (select 收入-> from salary-> where 编号 = 1)));1111 - Invalid use of group function```sql
函数使用无效(回课本敲例题了,敲完再来)
mysql> select 姓名 from employees as e,departments as d,salary as a-> where 收入 > all-> (select 收入 from employees as e,departments as d,salary as s-> where e.部门号 = d.部门号 and s.编号 = e.编号 and d.部门名称 = '财务部')-> and e.部门号 = d.部门号 and a.编号 = e.编号 and d. 部门名称 = '研发部';
over