SQL
SQL
Sales :
order_id
product_id
order_date
total_amount
sales_person_id
---------------------------------
Products :
product_id
product_name
product_category
---------------------------------
Sales_Person :
person_id
manager_id
assigned_region
---------------------------------
select
product_category, count(product_id) as count_products
from
products p
inner join
sales s on p.product_id = s.product_id
group by
product_category
2. asked to show also the products not sold - changed inner to left join
(Coalesce function)
4. (case)
--------------------------------
select
sum(total_amount)
from
six_days
(date_functions) to get
--------------------------------------------------------