Sql 甲骨文中的非自然连接
输入表: 电磁脉冲 系 萨尔 输出:Sql 甲骨文中的非自然连接,sql,oracle11g,Sql,Oracle11g,输入表: 电磁脉冲 系 萨尔 输出: EMPNO ENAME DEPTNO SAL DOJ DNAME LOC SALGRADE 100 abc 10 1000 09-Jul-2007 X BZA A 200 def 20 2000 09-Jul-2014 Y MTM B 300 ghi 30 3000 09-Jul-2009 Z HYB C 50
EMPNO ENAME DEPTNO SAL DOJ DNAME LOC SALGRADE
100 abc 10 1000 09-Jul-2007 X BZA A
200 def 20 2000 09-Jul-2014 Y MTM B
300 ghi 30 3000 09-Jul-2009 Z HYB C
500 mno 20 5000 09-Jul-2011 Y MTM E
编写sql查询以显示输出表。请尝试以下方法 第一条路
select top(4)*,(select salgrade from sal where emp.sal >= sal.LL and emp.sal<= sal.HL) as salgrade
from emp
inner join dept on emp.deptno=dept.deptno
order by empno
我们可以使用像select top4*这样的函数吗??当我们要选择最上面的行时。。。???
SALGRADE LL HL
A 100 1000
B 1001 2000
C 2001 3000
D 3001 4000
E 4001 6000
EMPNO ENAME DEPTNO SAL DOJ DNAME LOC SALGRADE
100 abc 10 1000 09-Jul-2007 X BZA A
200 def 20 2000 09-Jul-2014 Y MTM B
300 ghi 30 3000 09-Jul-2009 Z HYB C
500 mno 20 5000 09-Jul-2011 Y MTM E
select top(4)*,(select salgrade from sal where emp.sal >= sal.LL and emp.sal<= sal.HL) as salgrade
from emp
inner join dept on emp.deptno=dept.deptno
order by empno
select top(4)*
,(select salgrade from sal where emp.sal between sal.LL and sal.HL) as salgrade
from emp
inner join dept on emp.deptno=dept.deptno
order by empno