Identify the top 5 best selling products by total sales for the year 2023

SELECT product_id, SUM(units_sold * price) AS total_sales FROM sales_data WHERE date BETWEEN ‘2023-01-01’ AND ‘2023-12-31’ GROUP BY product_id ORDER BY total_sales DESC LIMIT 5;

Calculate the average of total monthly sales for the year 2023

SELECT AVG(monthly_sales) AS avg_monthly_sales FROM ( SELECT DATE_FORMAT(date, ‘%Y-%m’) AS month, SUM(units_sold * price) AS monthly_sales FROM sales_data WHERE date BETWEEN ‘2023-01-01’ AND ‘2023-12-31’ GROUP BY month ) AS monthly_sales_data;