子查询:先执行内部再外部
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
;