|
| 1 | +# Case Study #7 - Balanced Tree Clothing Co. :mountain_snow: |
| 2 | + |
| 3 | +<img src="https://user-images.githubusercontent.com/98699089/158577720-0de460fb-d90e-4aa2-a563-33136741f5bc.png" width="600"> |
| 4 | + |
| 5 | +Danny, the CEO of this trendy fashion company has asked you to assist the team’s merchandising teams analyse their sales performance and generate a basic financial report to share with the wider business. |
| 6 | + |
| 7 | +## Available Data |
| 8 | + |
| 9 | +For this case study there is a total of 4 datasets for this case study - however you will only need to utilise 2 main tables to solve all of the regular questions, and the additional 2 tables are used only for the bonus challenge question! |
| 10 | + |
| 11 | +### Product Details |
| 12 | + |
| 13 | +`balanced_tree.product_details` includes all information about the entire range that Balanced Clothing sells in their store. |
| 14 | + |
| 15 | +| product_id | price | product_name | category_id | segment_id | style_id | category_name | segment_name | style_name | |
| 16 | +|------------|-------|----------------------------------|-------------|------------|----------|---------------|--------------|---------------------| |
| 17 | +| c4a632 | 13 | Navy Oversized Jeans - Womens | 1 | 3 | 7 | Womens | Jeans | Navy Oversized | |
| 18 | +| e83aa3 | 32 | Black Straight Jeans - Womens | 1 | 3 | 8 | Womens | Jeans | Black Straight | |
| 19 | +| e31d39 | 10 | Cream Relaxed Jeans - Womens | 1 | 3 | 9 | Womens | Jeans | Cream Relaxed | |
| 20 | +| d5e9a6 | 23 | Khaki Suit Jacket - Womens | 1 | 4 | 10 | Womens | Jacket | Khaki Suit | |
| 21 | +| 72f5d4 | 19 | Indigo Rain Jacket - Womens | 1 | 4 | 11 | Womens | Jacket | Indigo Rain | |
| 22 | +| 9ec847 | 54 | Grey Fashion Jacket - Womens | 1 | 4 | 12 | Womens | Jacket | Grey Fashion | |
| 23 | +| 5d267b | 40 | White Tee Shirt - Mens | 2 | 5 | 13 | Mens | Shirt | White Tee | |
| 24 | +| c8d436 | 10 | Teal Button Up Shirt - Mens | 2 | 5 | 14 | Mens | Shirt | Teal Button Up | |
| 25 | +| 2a2353 | 57 | Blue Polo Shirt - Mens | 2 | 5 | 15 | Mens | Shirt | Blue Polo | |
| 26 | +| f084eb | 36 | Navy Solid Socks - Mens | 2 | 6 | 16 | Mens | Socks | Navy Solid | |
| 27 | +| b9a74d | 17 | White Striped Socks - Mens | 2 | 6 | 17 | Mens | Socks | White Striped | |
| 28 | +| 2feb6b | 29 | Pink Fluro Polkadot Socks - Mens | 2 | 6 | 18 | Mens | Socks | Pink Fluro Polkadot | |
| 29 | + |
| 30 | +### Product Sales |
| 31 | + |
| 32 | +`balanced_tree.sales` contains product level information for all the transactions made for Balanced Tree including quantity, price, percentage discount, member status, a transaction ID and also the transaction timestamp. |
| 33 | + |
| 34 | +| prod_id | qty | price | discount | member | txn_id | start_txn_time | |
| 35 | +|---------|-----|-------|----------|--------|--------|--------------------------| |
| 36 | +| c4a632 | 4 | 13 | 17 | t | 54f307 | 2021-02-13 01:59:43.296 | |
| 37 | +| 5d267b | 4 | 40 | 17 | t | 54f307 | 2021-02-13 01:59:43.296 | |
| 38 | +| b9a74d | 4 | 17 | 17 | t | 54f307 | 2021-02-13 01:59:43.296 | |
| 39 | +| 2feb6b | 2 | 29 | 17 | t | 54f307 | 2021-02-13 01:59:43.296 | |
| 40 | +| c4a632 | 5 | 13 | 21 | t | 26cc98 | 2021-01-19 01:39:00.3456 | |
| 41 | +| e31d39 | 2 | 10 | 21 | t | 26cc98 | 2021-01-19 01:39:00.3456 | |
| 42 | +| 72f5d4 | 3 | 19 | 21 | t | 26cc98 | 2021-01-19 01:39:00.3456 | |
| 43 | +| 2a2353 | 3 | 57 | 21 | t | 26cc98 | 2021-01-19 01:39:00.3456 | |
| 44 | +| f084eb | 3 | 36 | 21 | t | 26cc98 | 2021-01-19 01:39:00.3456 | |
| 45 | +| c4a632 | 1 | 13 | 21 | f | ef648d | 2021-01-27 02:18:17.1648 | |
| 46 | + |
| 47 | +### Product Hierarcy & Product Price |
| 48 | + |
| 49 | +These tables are used only for the bonus question where we will use them to recreate the `balanced_tree.product_details` table. |
| 50 | + |
| 51 | +`balanced_tree.product_hierarchy` |
| 52 | + |
| 53 | +| id | parent_id | level_text | level_name | |
| 54 | +|----|-----------|---------------------|------------| |
| 55 | +| 1 | Womens | Category | | |
| 56 | +| 2 | Mens | Category | | |
| 57 | +| 3 | 1 | Jeans | Segment | |
| 58 | +| 4 | 1 | Jacket | Segment | |
| 59 | +| 5 | 2 | Shirt | Segment | |
| 60 | +| 6 | 2 | Socks | Segment | |
| 61 | +| 7 | 3 | Navy Oversized | Style | |
| 62 | +| 8 | 3 | Black Straight | Style | |
| 63 | +| 9 | 3 | Cream Relaxed | Style | |
| 64 | +| 10 | 4 | Khaki Suit | Style | |
| 65 | +| 11 | 4 | Indigo Rain | Style | |
| 66 | +| 12 | 4 | Grey Fashion | Style | |
| 67 | +| 13 | 5 | White Tee | Style | |
| 68 | +| 14 | 5 | Teal Button Up | Style | |
| 69 | +| 15 | 5 | Blue Polo | Style | |
| 70 | +| 16 | 6 | Navy Solid | Style | |
| 71 | +| 17 | 6 | White Striped | Style | |
| 72 | +| 18 | 6 | Pink Fluro Polkadot | Style | |
| 73 | + |
| 74 | +`balanced_tree.product_prices` |
| 75 | + |
| 76 | +| id | product_id | price | |
| 77 | +|----|------------|-------| |
| 78 | +| 7 | c4a632 | 13 | |
| 79 | +| 8 | e83aa3 | 32 | |
| 80 | +| 9 | e31d39 | 10 | |
| 81 | +| 10 | d5e9a6 | 23 | |
| 82 | +| 11 | 72f5d4 | 19 | |
| 83 | +| 12 | 9ec847 | 54 | |
| 84 | +| 13 | 5d267b | 40 | |
| 85 | +| 14 | c8d436 | 10 | |
| 86 | +| 15 | 2a2353 | 57 | |
| 87 | +| 16 | f084eb | 36 | |
| 88 | +| 17 | b9a74d | 17 | |
| 89 | +| 18 | 2feb6b | 29 | |
| 90 | + |
| 91 | +## Table of Contents |
| 92 | + |
| 93 | +[Introduction](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#introduction) |
| 94 | + |
| 95 | +[Case Study Questions](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#case-study-questions) |
| 96 | + |
| 97 | +[High Level Sales Analysis](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#high-level-sales-analysis) |
| 98 | + |
| 99 | +[1. What was the total quantity sold for all products?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#1-what-was-the-total-quantity-sold-for-all-products) |
| 100 | + |
| 101 | +[2. What is the total generated revenue for all products before discounts?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#2-what-is-the-total-generated-revenue-for-all-products-before-discounts) |
| 102 | + |
| 103 | +[3. What was the total discount amount for all products?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#3-what-was-the-total-discount-amount-for-all-products) |
| 104 | + |
| 105 | +[Transaction Analysis](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#transaction-analysis) |
| 106 | + |
| 107 | +[1. How many unique transactions were there?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#1-how-many-unique-transactions-were-there) |
| 108 | + |
| 109 | +[2. What is the average unique products purchased in each transaction?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#2-what-is-the-average-unique-products-purchased-in-each-transaction) |
| 110 | + |
| 111 | +[3. What are the 25th, 50th and 75th percentile values for the revenue per transaction?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#3-what-are-the-25th-50th-and-75th-percentile-values-for-the-revenue-per-transaction) |
| 112 | + |
| 113 | +[4. What is the average discount value per transaction?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#4-what-is-the-average-discount-value-per-transaction) |
| 114 | + |
| 115 | +[5. What is the percentage split of all transactions for members vs non-members?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#5-what-is-the-percentage-split-of-all-transactions-for-members-vs-non-members) |
| 116 | + |
| 117 | +[6. What is the average revenue for member transactions and non-member transactions?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#6-what-is-the-average-revenue-for-member-transactions-and-non-member-transactions) |
| 118 | + |
| 119 | +[Product Analysis](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#product-analysis) |
| 120 | + |
| 121 | +[1. What are the top 3 products by total revenue before discount?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#1-what-are-the-top-3-products-by-total-revenue-before-discount) |
| 122 | + |
| 123 | +[2. What is the total quantity, revenue and discount for each segment?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#2-what-is-the-total-quantity-revenue-and-discount-for-each-segment) |
| 124 | + |
| 125 | +[3. What is the top selling product for each segment?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#3-what-is-the-top-selling-product-for-each-segment) |
| 126 | + |
| 127 | +[4. What is the total quantity, revenue and discount for each category?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#4-what-is-the-total-quantity-revenue-and-discount-for-each-category) |
| 128 | + |
| 129 | +[5. What is the top selling product for each category?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#5-what-is-the-top-selling-product-for-each-category) |
| 130 | + |
| 131 | +[6. What is the percentage split of revenue by product for each segment?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#6-what-is-the-percentage-split-of-revenue-by-product-for-each-segment) |
| 132 | + |
| 133 | +[7. What is the percentage split of revenue by segment for each category?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#7-what-is-the-percentage-split-of-revenue-by-segment-for-each-category) |
| 134 | + |
| 135 | +[8. What is the percentage split of total revenue by category?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#8-what-is-the-percentage-split-of-total-revenue-by-category) |
| 136 | + |
| 137 | +[9. What is the total transaction “penetration” for each product? (hint: penetration = number of transactions where at least 1 quantity of a product was purchased divided by total number of transactions)](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#9-what-is-the-total-transaction-penetration-for-each-product-hint-penetration--number-of-transactions-where-at-least-1-quantity-of-a-product-was-purchased-divided-by-total-number-of-transactions) |
| 138 | + |
| 139 | +[10. What is the most common combination of at least 1 quantity of any 3 products in a 1 single transaction?](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#10-what-is-the-most-common-combination-of-at-least-1-quantity-of-any-3-products-in-a-1-single-transaction) |
| 140 | + |
| 141 | +[Reporting Challenge](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#reporting-challenge) |
| 142 | + |
| 143 | +[Bonus Challenge](https://github.com/muryulia/8-Week-SQL-Challenge/blob/main/Case%20Study%20%237%20-%20Balanced%20Tree%20Clothing%20Co./Solution.md#bonus-challenge) |
0 commit comments