Create a View of Top 5 Selling Products
Products Table:

Top10SellingProducts, displays the top 5 best-selling products based on the total quantity sold.Products and OrderDetails tables, groups the data by ProductID and ProductName, and orders them in descending order of total sales.
SQL Query:
GO -- this starts a new batch
CREATE VIEW Top10SellingProducts AS
SELECT TOP 5
p.ProductID,
p.ProductName,
SUM(od.Quantity) AS TotalQuantitySold
FROM
Products p
INNER JOIN
OrderDetails od ON p.ProductID = od.ProductID
GROUP BY
p.ProductID, p.ProductName
ORDER BY
TotalQuantitySold DESC;
Output:

