What is sub quarries?
Is nested quarry. In one statement can have <= 255 levels of nesting. .
Inner Quarry execute firstly and ten the outer quarry.
1.Select first_name,last_name,salary
2.from employees
3.where salary >
4..(select salary from employees where last_name = 'Russell');
1,2,3 rows are inner quarry(Red color)
4 row is outer quarry (Blue color)
Two type of sub quarries
1. Single row sub quarry (scalar) - Return single column ,one row worth of data.
2. Multi row sub quarries - Return multiple records. Use following logical comparison terms (In,All,Not in,Some,Any) . these are boo-lean type operators.
IN - compare the list of values of equality
Any -check weather any value in the list make conditions true.Like "OR" operator.
Not In - negation of IN
Some - identical to any
Correlated Quarry.
Inner quarry use data from outer quarry , execute once for every row in outer quarry.
No comments:
Post a Comment