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

What is table value parameters (tvp)?

0 Answers  


Can multiple columns be used in sql group by clause in ms sql server?

0 Answers  


List the advantages of using stored procedures?

0 Answers  


what number files will a information contain in SQL Server? How many forms of information files exist in SQL Server? How many of those files can exist for a single database?

0 Answers  


Explain DBCC?

0 Answers   QuestPond,






explain declarative management framework (dmf) in sql server 2008?

0 Answers  


Is it possible to delete duplicate rows in a table without using a temporary table ?

12 Answers   TCS,


Can we return Data from 4(more than 1) tables in stored procedure?

0 Answers   HCL,


What are dml triggers and types of dml triggers?

0 Answers  


How to create a simple stored procedure in ms sql server?

0 Answers  


Explain what is analysis service repository?

0 Answers  


Define Foreign Key?

3 Answers   ADP, College School Exams Tests,


Categories