Subquery
CREATE TABLE Customers(
CustomerID INT PRIMARY KEY NOT NULL,
CustomerName VARCHAR(50),
ContactName VARCHAR(50),
Country VARCHAR(50);
CREATE TABLE Orders(
OrderID INT ,
OrderDate DATE);
INSERT INTO Orders(OrderID,OrderDate)
VALUES(1,'11/12/2020'),
(2,'14/12/2014'),
(3,'17/1/2019'),
(4,'18/2/2020');
INSERT INTO Customers(CustomerID,CustomerName, ContactName,Country)
VALUES (1,'John','David','USA'),
(2,'Leo','David','UK'),
(3,'David','John','USA'),
(4,'Betty','Leo','UK'),
(5,'Peter','Peter','UAE');
Customers table:
Orders table:
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.
Contact Us