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
8 changes: 8 additions & 0 deletions 1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
select customer_id
from Customer
group by customer_id
having count(distinct product_key) =
(
select count(product_key)
from product
)
9 changes: 9 additions & 0 deletions 2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Write your MySQL query statement below
with cte as (
select distinct product_id as p, min(year) as first_year
from sales
group by product_id
)
select product_id, first_year, quantity,price from sales
join cte
on product_id= p and year = first_year