Instagram
youtube
Facebook
Twitter

Calculate Total Revenue from All Orders in SQL

Calculate Total Revenue from All Orders in SQL

OrderDetails Table:

Query Explanation
SELECT SUM(Quantity * UnitPrice) AS TotalRevenue
 Calculates the total revenue by multiplying quantity and UnitPrice for each order detail, and sums them all.
 The result is shown as TotalRevenue.

FROM OrderDetails
 Specifies that the data is retrieved from the OrderDetails table, which contains quantity and price information for each order.

SQL Query:

select * from orderdetails;

select sum(Quantity * UnitPrice) as TotalRevenue  
from orderdetails;

 

Output: