Sub Queries:
------------
1. Single Row Sub Query - Inner query retrives only one row
2. Multiple Row Sub Query - Inner query retrives many rows
select name,salary from ex_details where salary > (Select salary from ex_details where name='DAS');
Multiple Sub Queries:
--------------------
select * from emp where salary < ANY (select salary from emp where dept=200);
// just like using OR operator
select * from emp where salary < ALL (select salary from emp where dept=200);
// just like using AND operator
select * from emp where salary IN (select salary from emp where dept=200);
// comparing each member
select name, salary from ex_details where dcode=(select e.dcode from ex_country l,ex_details e
where e.name='MARTIN' and (l.loc_id=e.loc_id))
Monday, October 11, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment