Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

#Aggregated DATA OF store #City wise Purchase

WITH
city_purchase AS(
SELECT
DISTINCT City,
COUNT(DISTINCT Product_ID) AS n_Items_purchased,
ROUND(SUM(Sales),2) AS revenue_generated
FROM
`customeranalytics-382708.customer_analyticsDS.customer_data `
GROUP BY
City )
SELECT
*
FROM
city_purchase
ORDER BY
revenue_generated DESC;

#Country wise purchase


WITH
c_purchase AS(
SELECT
DISTINCT Country,
COUNT(DISTINCT Product_ID) AS n_Items_purchased,
ROUND(SUM(Sales),2) AS revenue_generated
FROM
`customeranalytics-382708.customer_analyticsDS.customer_data `
GROUP BY
Country )
SELECT
*
FROM
c_purchase
ORDER BY
revenue_generated DESC;

#Category wise Purchase


WITH
cat_purchase AS(
SELECT
DISTINCT Category,
COUNT(DISTINCT Product_ID) AS n_Items_purchased,
ROUND(SUM(Sales),2) AS revenue_generated
FROM
`customeranalytics-382708.customer_analyticsDS.customer_data `
GROUP BY
Category )
SELECT
*
FROM
cat_purchase
ORDER BY
revenue_generated DESC;
#ShipMode used
WITH
shipmode_used AS(
SELECT
DISTINCT Ship_Mode,
COUNT(Ship_Mode) AS n_times_shipmode_used
FROM
`customeranalytics-382708.customer_analyticsDS.customer_data `
GROUP BY
Ship_Mode )
SELECT
*
FROM
shipmode_used
ORDER BY
n_times_shipmode_used DESC;

#Segment wise Purchase


WITH
s_purchase AS(
SELECT
DISTINCT Segment,
COUNT(DISTINCT Product_ID) AS n_Items_purchased,
ROUND(SUM(Sales),2) AS revenue_generated
FROM
`customeranalytics-382708.customer_analyticsDS.customer_data `
GROUP BY
Segment )
SELECT
*
FROM
s_purchase
ORDER BY
revenue_generated DESC;

You might also like