Answer Posted / rajkumar
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.
Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
How do database indexes work?
What is the difference between update lock and exclusive lock?
What is the difference between the 2 operating modes of database mirroring?
How self join is different from outer join?
tell me what is blocking and how would you troubleshoot it? : Sql server database administration
Explain about SQL server 2005?
What are data regions?
How do I determine how many instances of sql server are installed on a computer?
In what sequence sql statement is processed?
what are defaults? Is there a column to which a default can't be bound? : Sql server database administration
how many triggers you can have on a table? : Sql server database administration
Explain transaction isolation levels in sql server?
What is the use of for clause?
Explain timestamp datatype?
How connect excel to sql server?