Hi,
You can use the following query:
select (price_each * quantity_ordered) as totalAmount,
avg(price_each * quantity_ordered) as avgAmount,
round(price_each * quantity_ordered) as totalAmount_round,
round(avg(price_each * quantity_ordered)) as avgAmount_round
from order_details;
Rounded Total and Average Order Amounts
Description: Write a query to retrieve the total amount received from all orders, as well as the average amount and round the answers to the nearest integer.
The ROUND() function rounds a number to a specified number of decimal places.
number: required
decimals: optional
Note:
Table name: orderdetails
use priceEach * quantityOrdered to find the amount.
Sample Output