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 |
How to turn on the mssql api module in php?
can we have a nested transaction? : Sql server database administration
Explain what is log shipping?
Difference between connected and disconnected database in .net with sql server?
What are dml triggers and types of dml triggers?
Why do we need normalization?
What stored procedure would you use to view lock information?
Explain what is lock escalation and what is its purpose?
How to find 6th highest salary from Employee table ?
What do you understand by triggers and mention the different types of it?
What happens if date-only values are provided as date and time literals?
Can you explain different types of joins?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)