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
Why transaction is important?
What are the different types of data sources in ssrs?
What are the transaction properties?
What is the benefit of normalization?
What is the difference between ddl and dml?
What are the system database in sql server 2005?
What do you know about system database? : SQL Server Architecture
How do you set a trace flag in sql server?
How to drop an existing table with "drop table" statements in ms sql server?
Can we install sql server 2016 on windows 7?
What is transactional replication?
Explain filtered indexes benefits?
What are truncate options available in sql server? : sql server database administration
What is triggers in ms sql server?
Tell me what do you mean by an execution plan? Why is it used? How would you view it?