how many type of subquery?
Answers were Sorted based on User's Feedback
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 |
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?
List some advantages and disadvantages of stored procedure?
How to drop existing indexes in ms sql server?
What is the use of attributehierarchyvisible ? : sql server analysis services, ssas
How would you use user_constraints table in DB?
What is the difference between the export /import functions in sql studio and standalone sql manager? : sql server management studio
What is local temp table?
what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration
How cand Optimize SQL Server Stored Procedures
Explain important index characteristics?
Tell me what is the stuff and how does it differ from the replace function?
Can I run multiple instances of sql server 2000 at the same time on one computer?