In MySQL mastery course under My Essential MySQL Functions
7 - IF Function practice exercise
Shouldn’t count() be count(product_id) instead of count(*) because we are counting how many products are in each order_id? or does it matter?
select
p.product_id,
name,
count(product_id) as orders,
if(count(product_id) = 1, ‘Once’, ‘Many times’) as frequency
from products p
join order_items oi using (product_id)
group by product_id