ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories >> Software >> Databases >> SQL-Server
 
 
 
Question
how many type of subquery?
 Question Submitted By :: Rabinmeher
I also faced this Question!!     Rank Answer Posted By  
 
Answer
As database developer, you must have ever written 
subqueries in either SQL Server or any other database 
platform. This article will describe shortly about types of 
subquery.

  
A subquery is inner query that will be used by outer query. 
A subquery could return scalar value or a series of value. 
Based on query dependency, a subquery could be self-
contained or correlated one. A self-contained subquery is a 
subquery independent from outer query, and correlated 
subquery is a subquery that is referencing to a row in 
outer query.

  
Self-contained subquery is easier to debug than correlated 
subquery. And it is executed only once whereas correlated 
subquery is executed once for each row of outer query.

  
Sample of self-contained subquery that returns scalar value 
is shown below :

  
Select customerid

From dbo.orders

Where employeeid = (select employeeid from dbo.employees 
where lastname = ‘RAJ’);

  
This query returns customers list whose employee is RAJ.
 
0
Rajkumar
 
View All Answers
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com