下面有两个表格
员工表:empid, empname, deptid
部门表:deptid, deptname
然后将查询写入“列出dept name = computer的所有员工”
答案 0 :(得分:3)
这应该非常简单,
SELECT a.empid, a.empname, b.deptname
FROM employee a
INNER JOIN department b
ON a.deptid = b.deptid
ORDER BY b.deptname, a.empname
要进一步了解联接,请访问以下链接:
答案 1 :(得分:0)
SELECT e.empname, deptname
FROM employee e
INNER JOIN department d
ON e.deptid = d.deptid
GROUP BY emptname, deptname
答案 2 :(得分:0)
SELECT empname, deptname
from employee, department
where employee.deptid=department.deptid
and department.deptname='computer';
计算机必须根据您表格中的值
区分大小写