Sql Query打印ename和dname请分享我如何在oracle或Mysql中编写查询

时间:2015-07-22 15:31:40

标签: mysql oracle10g

员工
开斋节工资 1个查尔斯3000
2 kiran 2000
3 naveen 8000
4 manju 7000

deptid dname
101名查尔斯 102 kiran
103 naveen
104 manju

注册

deptid eid

101 1
102 2
103 3
104 4

向print(employee)ename和(department)dname写一个查询。

1 个答案:

答案 0 :(得分:0)

SELECT a.ename, b.depart, c.eid
FROM  employee a
INNER JOIN department b on a.ename=b.dname
INNER JOIN register c on b.deptid=c.deptid
where a.ename=b.dname and b.deptid=c.deptid;