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

I need a query that retrieves info from an Oracle table and a query that retrieves info from a SQL Server table. The info has to be joined together according to Record ID numbers. I have very limited access to the Oracle database but full control of the SQL Server database.How do I join two different queries from two different databases?

1 Answers  


List some advantages and disadvantages of stored procedure?

0 Answers  


How to drop existing indexes in ms sql server?

0 Answers  


What is the use of attributehierarchyvisible ? : sql server analysis services, ssas

0 Answers  


How would you use user_constraints table in DB?

0 Answers   Wipro,






What is the difference between the export /import functions in sql studio and standalone sql manager? : sql server management studio

0 Answers  


What is local temp table?

0 Answers  


what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration

0 Answers  


How cand Optimize SQL Server Stored Procedures

1 Answers  


Explain important index characteristics?

0 Answers  


Tell me what is the stuff and how does it differ from the replace function?

0 Answers  


Can I run multiple instances of sql server 2000 at the same time on one computer?

0 Answers  


Categories