Professional Documents
Culture Documents
Syntax
Screenshot
Syntax
SELECT ship.ShipperName
FROM Shippers as ship INNER JOIN Orders as ord ON ship.ShipperID = ord.ShipperID
WHERE OrderID LIKE '10318';
Screenshot
1
3. Display the OrderIDs who ordered for an item which has 1 kg pkg. Unit.
Syntax
SELECT od.OrderID
FROM OrderDetails as od INNER JOIN Products as pd ON od.ProductID = pd.ProductID
WHERE Unit LIKE '1 kg pkg.';
Screenshot
4. Display the Order date when the Customers from the city, ‘Buenos Aires’ placed
an order.
2
Syntax
SELECT ord.OrderDate
FROM Orders AS ord INNER JOIN Customers AS cus ON ord.CustomerID =
cus.CustomerID
WHERE City = 'Buenos Aires';
Screenshot
Syntax
SELECT Cust.CustomerName
FROM Customers AS cust JOIN Orders AS ord ON cust.CustomerID = ord.CustomerID
JOIN OrderDetails AS orddet ON ord.OrderID = orddet.OrderID
JOIN Products AS pro ON orddet.ProductID = pro.ProductID
WHERE pro.Price = (SELECT MAX(Price) FROM Products);
3
6. Display the Category name of the product which was ordered in
quantity=33.
Syntax
SELECT cat.CategoryName
FROM Categories AS cat JOIN Products AS pro ON cat.CategoryID =
pro.CategoryID
JOIN OrderDetails AS orddet ON pro.ProductID = orddet.ProductID
WHERE orddet.Quantity LIKE '33';
Screenshot
4
7. Display the Product name which has the highest quantity of order.
Syntax
SELECT pro.ProductName
FROM Products pro JOIN OrderDetails od ON pro.ProductID = od.ProductID
WHERE od.Quantity = (SELECT MAX(Quantity) FROM OrderDetails);
5
Syntax
SELECT CustomerName
FROM Customers cus JOIN Orders ord ON cus.CustomerID = ord.CustomerID
WHERE '1997-02-07' < ord.OrderDate;
Screenshot
9. Display the Customer names who ordered less than quantity=2 in their orders.
Syntax
SELECT CustomerName
FROM Customers cus JOIN Orders ord ON cus.CustomerID = ord.CustomerID
JOIN OrderDetails orddet ON ord.OrderID = orddet.OrderID
WHERE orddet.Quantity < 2;
Screenshot
6
10. Display the sum of the price of products that was ordered in the
OrderID=10263.
Syntax
SELECT SUM(Price)
FROM Products pro JOIN OrderDetails ord ON pro.ProductID = ord.ProductID
WHERE ord.OrderID = '10263';
Screenshot