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
3 changes: 3 additions & 0 deletions Problem1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
WITH CTE AS (SELECT *, DENSE_RANK()
OVER(PARTITION BY product_id ORDER BY year) as 'first_year' from sales )
Select product_id, year as 'first_year', quantity, price from CTE where first_year = 1
2 changes: 2 additions & 0 deletions Problem2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT customer_id from customer group by customer_id
having COUNT(Distinct product_key) = (Select COUNT(distinct product_key) from product)