From ccd12f0d1e8f7c2d42a94347b99a6352687e7287 Mon Sep 17 00:00:00 2001 From: Ankitha Boindala Date: Thu, 2 Jan 2025 23:23:10 -0600 Subject: [PATCH] commit --- customers_who_bought.sql | 2 ++ product_sales_analysis.sql | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 customers_who_bought.sql create mode 100644 product_sales_analysis.sql diff --git a/customers_who_bought.sql b/customers_who_bought.sql new file mode 100644 index 0000000..590ef9f --- /dev/null +++ b/customers_who_bought.sql @@ -0,0 +1,2 @@ +select customer_id from customer group by customer_id having count (distinct +product_key) = (select count(product_key) FROM product); \ No newline at end of file diff --git a/product_sales_analysis.sql b/product_sales_analysis.sql new file mode 100644 index 0000000..4104ebd --- /dev/null +++ b/product_sales_analysis.sql @@ -0,0 +1,3 @@ +select product_id, year as first_year, quanitity, price from sales where +(product_id, year) in (select product_id, min year) as year from sales +GROUP BY product_id; \ No newline at end of file