Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Customers_who_bought_all_products.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--Write your MySQL query statement below
select customer_id from customer group by customer_id having count(distinct product_key) = (select count(product_key) from product);
4 changes: 4 additions & 0 deletions Product_sales_analysis_iii.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--Write your MySQL query statement below
with cte as (select distinct product_id , min(year) over (partition by product_id) as 'first_year' from sales )
select s.product_id, s.year as 'first_year', s.quantity, s.price from sales s inner join cte c on c.product_id = s.product_id and s.year = c.first_year