Difference between a query, sub query and a nested sub query?
-
What is difference between a query, sub query and a nested sub query? A query within a query is called sub query, then what is actually nested sub query and some people say that a query in WHERE clause of another sub query is called nested sub query. What is the actual difference between them? If possible, give me an example for easy understanding.What is difference between a query, sub query and a nested sub query? A query within a query is called sub query, then what is actually nested sub query and some people say that a query in WHERE clause of another sub query is called nested sub query. What is the actual difference between them? If possible, give me an example for easy understanding. What is difference between a query, sub query and a nested sub query? A query within a query is called sub query, then what is actually nested sub query and some people say that a query in WHERE clause of another sub query is called nested sub query. What is the actual difference between them? If possible, give me an example for easy understanding. Link to Questions, Topics, Blogs and People
-
Answer:
I believe your confusion may be because of lax terminology used by the SQL/database community. I will often here the terms sub-query and nested sub-query used interchangeably - in some cases it's inaccurate to do so, but in others not. A nested sub-query is a type of sub-query where the result of the sub-query is only calculated once and applied as a condition to each row retrieved by the parent query. For example, imagine the following example where I want to select users' names where they are considered an adult in the US. select u.first_name, u.last_name from tUsers u where u.age > ( select a.age from tRegionalAdultAge a where a.country_code = 'US' ); A correlated sub-query is a type of sub-query where the result of the sub-query is calculated for each row retrieved in the parent query because it is logically dependent on a value in that row. For example, imagine the following example where I want to select users' names where they are considered an adult in their own country. select u.first_name, u.last_name from tUsers u where u.age > ( select a.age from tRegionalAdultAge a where a.country_code = u.country_code );
Alec Maddison at Quora Visit the source
Related Q & A:
- What's the difference between a US version PSP and a Japan version PSP?Best solution by Yahoo! Answers
- What is the difference between a 2ohm sub and a 4 ohm sub?Best solution by knowledge.sonicelectronix.com
- Whats the difference between a city, a state and a city-state?Best solution by Yahoo! Answers
- What's the difference between a syndrome, a disorder, and a disease?Best solution by Quora
- How can I turn my dual sub box into a single sub box?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.