码迷,mamicode.com
首页 > 数据库 > 详细

Oracle篇 之 子查询

时间:2019-04-23 20:43:28      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:name   inf   from   oracl   mil   ora   .com   http   style   

子查询:先执行内部再外部

Select last_name,salary,dept_id

From s_emp

Where dept_id in (

Select dept_id

From s_emp

Where dept_id is not null

);

 

Select last_name,dept_id

From s_emp

Where dept_id = (

Select dept_id

From s_emp

Where last_name=’Smith’

);

 

Select salary,last_name

From s_emp

Where salary<(

Select avg(salary)

From s_emp

);

 

Select last_name,dept_id,title

From s_emp

Where dept_id =(

Select dept_id

From s_emp

Where last_name=’Smith’

) and tltle = (select tltle

From s_emp

Where last_name=’Smith’

);

 

Select rownum,last_name,salary

From s_emp

Where rownum<=20

minus

Select rownum,last_name,salary

From s_emp

Where rownum<=10

;

技术图片

Oracle篇 之 子查询

标签:name   inf   from   oracl   mil   ora   .com   http   style   

原文地址:https://www.cnblogs.com/wskb/p/10758646.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!