<p>
程序输出
SELECT DISTINCT employee.lname, employee.fname
FROM employee, department
WHERE salary > (SELECT AVG(employee.salary)
FROM employee, department
WHERE employee.dno = department.dnumber);
正确的输出
lname fname
Wong Franklin
Wallace Jennifer
Narayan Ramesh
Borg James
答案 0 :(得分:0)
使用始终正确的显式标准JOIN
语法并限定您的列名:
SELECT DISTINCT e.lname, e.fname
FROM employee e INNER JOIN
department d
ON d.dnumber = e.dno
WHERE e.salary > (SELECT AVG(e1.salary)
FROM employee e1 INNER JOIN
department d1
ON d1.dnumber = e1.dno
);