__STYLES__
For complete Presentation and the Outputs, follow the below link:
https://github.com/SakshiYadav13/Strategic-Analysis-for-Balanced-Tree-SQL-Case-Study/blob/main/8WEEKSSQLCHALLENGE.COM.pptx
Balanced Tree Clothing Company specializes in providing a curated selection of clothing and lifestyle wear for modern adventurers. To maintain a competitive edge, the company seeks to analyze its sales performance, understand customer behaviors, and generate financial reports to inform business decisions. Danny, the CEO, emphasizes the need for actionable insights to enhance overall business operations.
The primary objective of this report is to analyze sales data to uncover trends and insights that can inform merchandising strategies and financial planning. Specific goals include:
The analysis utilizes two primary datasets:
balanced_tree.product_details
): Contains product-specific information including product IDs, names, categories, and segments.balanced_tree.sales
): Includes transaction-level data, capturing quantity sold, transaction prices, discounts, member status, and timestamps of sales.The analysis follows these key steps:
Data Extraction: Retrieve relevant data from the product details and sales tables.
Data Transformation: Prepare and clean the data as needed for analysis, ensuring data types align and missing values are addressed.
Data Analysis: Execute SQL queries to derive insights based on predefined business questions.
Reporting: Summarize findings and insights in a structured format to facilitate decision-making.
To analyze the sales performance and gain insights into customer behavior, several SQL queries were executed. The following queries provide valuable metrics:
SELECT SUM(qty) AS total_quantity_sold FROM balanced_tree.sales;
SELECT SUM(qty * price) AS total_revenue_before_discount FROM balanced_tree.sales;
SELECT SUM(discount) AS total_discount_amount FROM balanced_tree.sales;
SELECT COUNT(DISTINCT txn_id) AS unique_transactions FROM balanced_tree.sales;
SELECT ROUND(AVG(product_count), 2) AS avg_unique_products_per_transaction FROM (SELECT txn_id, COUNT(DISTINCT prod_id) AS product_count FROM balanced_tree.sales GROUP BY txn_id) AS transaction_product_counts;
WITH transaction_revenue AS (SELECT txn_id, SUM(qty * price) AS transaction_total_revenue FROM balanced_tree.sales GROUP BY txn_id) SELECT PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY transaction_total_revenue) AS percentile_25, PERCENTILE_CONT(0.50) WITHIN GROUP (ORDER BY transaction_total_revenue) AS percentile_50, PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY transaction_total_revenue) AS percentile_75 FROM transaction_revenue;
SELECT ROUND(AVG(transaction_discount), 2) AS avg_discount_per_transaction FROM (SELECT txn_id, SUM(discount) AS transaction_discount FROM balanced_tree.sales GROUP BY txn_id) AS transaction_discounts;
SELECT member, ROUND(COUNT(DISTINCT txn_id) * 100.0 / (SELECT COUNT(DISTINCT txn_id) FROM balanced_tree.sales), 2) AS percentage_split FROM balanced_tree.sales GROUP BY member;
SELECT member, ROUND(AVG(qty * price), 2) AS avg_revenue_per_transaction FROM balanced_tree.sales GROUP BY member;
SELECT pd.product_name, SUM(s.qty * s.price) AS total_revenue_before_discount FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.product_name ORDER BY total_revenue_before_discount DESC LIMIT 3;
SELECT pd.segment_name, SUM(s.qty) AS total_quantity, SUM(s.qty * s.price) AS total_revenue, SUM(s.discount) AS total_discount FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.segment_name;
WITH ranked_products AS (SELECT pd.segment_name, pd.product_name, SUM(s.qty) AS total_quantity_sold, ROW_NUMBER() OVER (PARTITION BY pd.segment_name ORDER BY SUM(s.qty) DESC) AS rank FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.segment_name, pd.product_name) SELECT segment_name, product_name, total_quantity_sold FROM ranked_products WHERE rank = 1;
SELECT pd.category_name, SUM(s.qty) AS total_quantity, SUM(s.qty * s.price) AS total_revenue, SUM(s.discount) AS total_discount FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.category_name;
WITH ranked_products AS (SELECT pd.category_name, pd.product_name, SUM(s.qty) AS total_quantity_sold, ROW_NUMBER() OVER (PARTITION BY pd.category_name ORDER BY SUM(s.qty) DESC) AS rank FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.category_name, pd.product_name) SELECT category_name, product_name, total_quantity_sold FROM ranked_products WHERE rank = 1;
SELECT pd.segment_name, pd.product_name, ROUND(SUM(s.qty * s.price) * 100.0 / SUM(SUM(s.qty * s.price)) OVER (PARTITION BY pd.segment_name), 2) AS revenue_percentage FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.segment_name, pd.product_name;
SELECT pd.category_name, pd.segment_name, ROUND(SUM(s.qty * s.price) * 100.0 / SUM(SUM(s.qty * s.price)) OVER (PARTITION BY pd.category_name), 2) AS segment_revenue_percentage FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.category_name, pd.segment_name;
SELECT pd.category_name, ROUND(SUM(s.qty * s.price) * 100.0 / SUM(SUM(s.qty * s.price)) OVER (), 2) AS category_revenue_percentage FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.category_name;
SELECT pd.product_name, ROUND(COUNT(DISTINCT s.txn_id) * 100.0 / (SELECT COUNT(DISTINCT txn_id) FROM balanced_tree.sales), 2) AS penetration_percentage FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY pd.product_name;
WITH transaction_combinations AS (SELECT txn_id, STRING_AGG(pd.product_name, ', ') AS product_combination FROM balanced_tree.sales s JOIN balanced_tree.product_details pd ON s.prod_id = pd.product_id GROUP BY txn_id) SELECT product_combination, COUNT(*) AS combination_count FROM transaction_combinations GROUP BY product_combination ORDER BY combination_count DESC LIMIT 1;
The analysis process encountered several challenges that impacted data accuracy and efficiency. These included:
Data Quality and Consistency:
Performance Issues:
Complex Queries and Logic:
Understanding Customer Segmentation:
The analysis yielded significant insights that can drive strategic decisions for Balanced Tree Clothing Company:
Sales Trends and Seasonality:
Customer Engagement:
Product Performance:
Discount Impact:
To capitalize on the insights gained from the analysis, the following recommendations are proposed:
Enhanced Marketing Strategies:
Inventory Optimization:
Regular Data Analysis:
Segmentation and Personalization:
This report outlines the key insights derived from analyzing sales performance at Balanced Tree Clothing Company. By understanding sales trends, customer engagement, and product performance, the company is better positioned to make informed decisions that enhance business operations.
Moving forward, it is essential to establish a systematic approach for ongoing data analysis. This will not only facilitate timely insights but also allow the company to remain agile in response to evolving market conditions. Continuous monitoring and adaptation based on customer behaviors will be crucial for sustained growth and profitability.