Nested Subquery
In Nested Query, the Inner query runs first, and only once. Outer query is executed with the result from Inner query. Hence, the Inner query is used in execution of the Outer query.
Example:
Orders (OrderID, CustomerID, OrderDate);
Customers (CustomerID, CustomerName, ContactName, Country);
Find details of customers who have ordered.
Query
SELECT * FROM Customers WHERE
CustomerID IN (SELECT CustomerID FROM Orders);
Output
Difference between Nested Subquery, Correlated Subquery and Join Operation
Joins are used to combine two or more different tables based on a common field between them with the help of this we can easily retrieve the data from multiple tables. So, In this article, we are going to discuss the JOIN Operation, and Subquery in detail. Let’s start with the JOIN operation.