how many type of subquery?

Answers were Sorted based on User's Feedback



how many type of subquery?..

Answer / 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

how many type of subquery?..

Answer / somu

2

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More SQL Server Interview Questions

how do you implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql server database administration

0 Answers  


how to trace the traffic hitting a sql server? : Sql server database administration

0 Answers  


How to provide Security for package?

1 Answers   Convergys,


How to create new tables with "select ... Into" statements in ms sql server?

0 Answers  


Can I delete event logs?

0 Answers  






Can a unique index be created on a column, which contains null?

0 Answers  


Is sql server a database?

0 Answers  


What will you do If the low Performance occurs?

2 Answers  


How to read data in a table with "select" statements?

0 Answers  


How to modify the underlying query of an existing view?

0 Answers  


What are the approximate numeric data types?

0 Answers  


Can we use max in where clause?

0 Answers  


Categories