ORACLE进阶(十三)using关键字学习_oracle using where

where tb1.jugsumid = #jugsumid# 
and tb1.blnorg = #blnorg# 
and isvld = '1' 
order by tb.typ asc, tb.oprorder asc 

`sql/92`标准可以使用`using`关键字来简化连接查询,但是只是在查询满足下面两个条件时,才能使用`using`关键字进行简化。



> 
> 1. 查询必须是等值连接。
> 2. 等值连接中的列必须具有相同的名称和数据类型。
> 
> 
> 


例如:使用`using`关键字,如下:



select emptno,ename,sal,deptno,dname from emp e inner join dept d using(deptno);


如上述语句执行的结果与自然连接的结果相同。


使用`using`关键字简化连接时,需要注意以下几点:



> 
> 1. 使用emp表和dept表中的deptno列进行连接时,在`using`子句和`select`子句中,都不能为deptno列指定表名或表别名。
> 2. 如果在连接查询时使用了两个表中相同的多个列,那么就可以在`using`子句中指定多个列名。
> 
> 
> 


形式如下:



select… from table1 inner join table2 using(column1,column2)


上述的语句相当于下面的语句:



select… from table1 inner join table2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值