3. JOIN

The JOIN statement allows you to combine data from multiple tables based on a related column. This is useful for retrieving information that spans across different tables.

Example:

SELECT Customers.CustomerName, Orders.OrderDate
FROM Customers
JOIN Orders ON Customers.CustomerID = Orders.CustomerID;

This query retrieves customer names and the corresponding order dates by joining the "Customers" and "Orders" tables on the common "CustomerID" column.

4. GROUP BY

The GROUP BY statement is used to group rows with similar values in a specified column and then perform aggregate functions on those groups, such as summing, counting, or finding averages.

Example:

SELECT Category, AVG(Price) AS AvgPrice
FROM Products
GROUP BY Category;

This query calculates the average price of products in each category.

5. ORDER BY

The ORDER BY statement is used to sort the result set in ascending or descending order based on one or more columns.

Example:

SELECT ProductName, Price
FROM Products
ORDER BY Price DESC;

This query retrieves product names and prices, sorting them in descending order of price.