如何缩短这个查询

如何缩短这个查询

本文介绍了如何缩短这个查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是sql查询的初学者



选择

EmployeeName.ID,EmployeeName.Ename,

Department.DepartmentName



来自

(Employee.Dept = Department.ID上的员工内部加入部门)

内连接Employee.ID上的EmployeeName = EmployeeName.ID;



我怎么能像这样写代码....



选择e.ename作为'名称'd.dname作为'dept-name'从emp-dpt作为e join emp作为e1在e.id = e.id加入dept作为d on d .did = e1.d.id



i认为两者都相同,但查询stlye是deffrent

i am beginner of sql query

select
EmployeeName.ID,EmployeeName.Ename,
Department.DepartmentName

from
(Employee inner join Department on Employee.Dept=Department.ID)
inner join EmployeeName on Employee.ID=EmployeeName.ID;

how can i write the code shortly like this....

select e.ename as 'name' d.dname as 'dept-name' from emp-dpt as e join emp as e1 on e.id = e.id join dept as d on d.did=e1.d.id

i think both are same but query stlye is deffrent

推荐答案


这篇关于如何缩短这个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 21:37