Welcome Back

Google icon Sign in with Google
OR
I agree to abide by Pharmadaily Terms of Service and its Privacy Policy

Create Account

Google icon Sign up with Google
OR
By signing up, you agree to our Terms of Service and Privacy Policy
Instagram
youtube
Facebook

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: