Skip to content
Advertisement

Write a query to display the total month wise sales amount received in the past 1 year

Table StructureWrite a query to display the total month wise sales amount received in the past 1 year . Display details like sales month, total sales amount. Give an alias_name as MONTH for retrieved sales month, TURN_OVER for sales amount. Sort the result by amount in descending order.

(Hint: Use table Sales_info. Use to_char for retrieving the month. Net amount for sales amount calculation. Use sysdate for calculation of past 1 year sales. DATA IS CASE-SENSITIVE.)

The code I have written is fetching me all years sales data.

select to_char(Sales_Date,'Month')"MONTH"
Net_Amount as Turn_Over
from Sales_Info
where Sales_Date= add_months(Sysdate,-12)

Advertisement

Answer

select to_char(Sales_Date,’MON’)”MONTH”, Net_Amount as TURN_OVER from Sales_Info where Sales_Date > add_months(Sysdate,-12) order by Net_Amount desc;

5 People found this is helpful
Advertisement