Company: Zomato_product_Analyst
Difficulty: medium
Problem Description You are given two tables: Orders , which contains order dates, and OrderDetails , which contains item prices and quantities. Write a SQL query to calculate the total monthly revenue for each year and month. Extract the year and numeric month from the order date. Calculate the total revenue for each month across all years using the formula: SUM(unitprice * qty) . Schema Orders Table order_id (INT): The unique identifier for each order. order_date (DATE): The date when the order was placed. OrderDetails Table order_id (INT): The identifier linking the details to the Orders table. unitprice (DECIMAL): The price of a single unit of the item. qty (INT): The quantity of items ordered. Required Output The output table must have the following columns: year : The year of the order. month : The numeric month of the order (e.g., 1 for January, 2 for February). revenue : The total calculated revenue for that year and month. The result should be sorted chronologically by year an