#查询每个商品类别在 2024 年 1 月 1 日至 2024 年 6 月 30 日期间的销售总额以及购买该类别商品的男性和女性客户数量。查询出来的数据按照类别 ID 升序排列。
select category_id,sum(order_amount) as total_sales,
        sum(if(customer_gender = '男',1,0)) as male_customers,
        sum(if(customer_gender = '女',1,0)) as female_customers
from order_details as a
inner join customer_info as b
on a.order_id = b.order_id
where order_date between '2024-01-01' and '2024-06-30'
group by category_id
order by category_id