0% found this document useful (0 votes)
3 views

submission_template_coded_project (1)

New-Wheels, a vehicle resale company, is facing declining sales and customer dissatisfaction, prompting the CEO to request a quarterly report on key metrics. The report includes insights on customer distribution, vehicle preferences, average ratings, feedback trends, and shipping times, revealing significant challenges in customer satisfaction and revenue. Recommendations include improving shipping processes, enhancing vehicle quality, and focusing on popular vehicle models to regain customer trust and boost sales.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

submission_template_coded_project (1)

New-Wheels, a vehicle resale company, is facing declining sales and customer dissatisfaction, prompting the CEO to request a quarterly report on key metrics. The report includes insights on customer distribution, vehicle preferences, average ratings, feedback trends, and shipping times, revealing significant challenges in customer satisfaction and revenue. Recommendations include improving shipping processes, enhancing vehicle quality, and focusing on popular vehicle models to regain customer trust and boost sales.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

New Wheels Project

Introduction to SQL

Problem Statement

Business Context

A lot of people in the world share a common desire: to own a vehicle. A car or an automobile is seen as an
object that gives the freedom of mobility. Many now prefer pre-owned vehicles because they come at an
affordable cost, but at the same time, they are also concerned about whether the after-sales service provided
by the resale vendors is as good as the care you may get from the actual manufacturers.

New-Wheels, a vehicle resale company, has launched an app with an end-to-end service from listing the
vehicle on the platform to shipping it to the customer's location. This app also captures the overall after-sales
feedback given by the customer.

Objective

New-Wheels sales have been dipping steadily in the past year, and due to the critical customer feedback and
ratings online, there has been a drop in new customers every quarter, which is concerning to the business. The
CEO of the company now wants a quarterly report with all the key metrics sent to him so he can assess the
health of the business and make the necessary decisions.

As a data analyst, you see that there is an array of questions that are being asked at the leadership level that
need to be answered using data. Import the dump file that contains various tables that are present in the
database. Use the data to answer the questions posed and create a quarterly business report for the CEO.

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 1
Business Questions

Question 1: Find the total number of customers who have placed orders. What is
the distribution of the customers across states?

Solution Query:

SELECT

state,

COUNT(DISTINCT customer_t.customer_id) AS number_of_customers

FROM

customer_t

JOIN

order_t ON customer_t.customer_id = order_t.customer_id

GROUP BY

state;

Output:

Observations and Insights:

 Top 3 States with highest numbers of customers are California, Texas and Florida.
 Last 3 States with lowest number of customers are Maine, Vermont and Wyoming.

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 2
Question 2: Which are the top 5 vehicle makers preferred by the
customers?

Solution Query:

SELECT

vehicle_maker, COUNT(*) AS total_customers

FROM

product_t

GROUP BY vehicle_maker

ORDER BY total_customers DESC

LIMIT 5;

Output :

Observations and Insights:

 Chevrolet has the highest number of total customers with 83, making it the most popular vehicle
maker among the given options
 Ford follows closely behind with 63 total customers, Toyota comes in third place with 52 total
customers, showing a good level of popularity among consumers
 Dodge and Pontiac both have 50 total customers, making them equally preferred among the given
options
 The data suggests that Chevrolet and Ford have a relatively larger market share compared to other
vehicle makers

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 3
Question 3: Which is the most preferred vehicle maker in each
state?

Solution Query:

SELECT

state,

vehicle_maker,

customer_count

FROM (

SELECT

customer_t.state AS state,

product_t.vehicle_maker AS vehicle_maker,

COUNT(order_t.customer_id) AS customer_count,

RANK() OVER (PARTITION BY customer_t.state ORDER BY COUNT(order_t.customer_id) DESC) AS


vehicle_rank

FROM

customer_t

JOIN

order_t ON customer_t.customer_id = order_t.customer_id

JOIN

product_t ON order_t.product_id = product_t.product_id

GROUP BY

customer_t.state, product_t.vehicle_maker

) AS ranked

WHERE

vehicle_rank = 1;

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 4
Output:

Observations and Insights:

 Chevrolet is the most preferred vehicle maker in 17 states, indicating a strong presence and popularity
in those regions
 Dodge follows closely behind with 12 states, suggesting a significant market share in these states
 Pontiac, Ford, and Toyota also enjoy substantial popularity, being most preferred in 11, 10, and9
states respectively
 The top five vehicle makers (Chevrolet, Dodge, Pontiac, Ford, and Toyota) dominate the preferences in
a total of 59 states
 Vehicle makers, such as Jaguar, Maybach, Ram, Oldsmobile, Saab, Porsche, and Ferrari, are preferred
in only one state, indicating a relatively limited market presence

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 5
Question 4: Find the overall average rating given by the customers.
What is the average rating in each quarter?

Consider the following mapping for ratings: “Very Bad”: 1, “Bad”: 2, “Okay”: 3,
“Good”: 4, “Very Good”: 5

Solution Query:

WITH CUSTOMER_RATING AS (

SELECT

quarter_number,

CASE

WHEN customer_feedback = 'Very Bad' THEN 1

WHEN customer_feedback = 'Bad' THEN 2

WHEN customer_feedback = 'Okay' THEN 3

WHEN customer_feedback = 'Good' THEN 4

WHEN customer_feedback = 'Very Good' THEN 5

END AS rating

FROM order_t )

SELECT

0 AS period, AVG(rating) AS average_rating

FROM CUSTOMER_RATING

UNION ALL

SELECT

quarter_number AS period,

AVG(rating) AS average_rating

FROM CUSTOMER_RATING

GROUP BY quarter_number

ORDER BY period;

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 6
Output:

Observations and Insights:

 The average rating shows a decreasing trend over the quarters. It started at 3.55 in Quarter 1and
gradually declined to 2.4 in Quarter 4. This suggests a potential dissatisfaction towards vehicle
makers
 The largest drop in average rating occurred between Quarter 1 and Quarter 3. It decreased by 0.59
points during this period
 Quarter 4has the lowest average rating of all the quarters, indicating that it was the least satisfactory
rated period. It is important to analyze what factors contributed to this drop and take necessary
actions to improve the ratings in the subsequent quarters

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 7
Question 5: Find the percentage distribution of feedback from the
customers. Are customers getting more dissatisfied over time?

Solution Query:

WITH FEEDBACK AS

SELECT

quarter_number,

SUM(CASE WHEN customer_feedback = 'Very Bad' THEN 1 ELSE 0 END) AS Very_Bad,

SUM(CASE WHEN customer_feedback = 'Bad' THEN 1 ELSE 0 END) AS Bad,

SUM(CASE WHEN customer_feedback = 'Okay' THEN 1 ELSE 0 END) AS Okay,

SUM(CASE WHEN customer_feedback = 'Good' THEN 1 ELSE 0 END) AS Good,

SUM(CASE WHEN customer_feedback = 'Very Good' THEN 1 ELSE 0 END) AS Very_Good,

COUNT(customer_feedback) AS Total_Feedback

FROM order_t

GROUP BY 1

SELECT

CONCAT('Q', quarter_number) AS Quarter,

Very_Bad / Total_Feedback * 100 AS Perc_Very_Bad,

Bad / Total_Feedback * 100 AS Perc_Bad,

Okay / Total_Feedback * 100 AS Perc_Okay,

Good / Total_Feedback * 100 AS Perc_Good,

Very_Good / Total_Feedback * 100 AS Perc_Very_Good,

(Very_Bad + Bad) / Total_Feedback * 100 AS Perc_Dissatisfied

FROM FEEDBACK

ORDER BY 1;

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 8
Output:

Observations and Insights:

 The percentage of "Very Good" and "Good" feedback declined from Quarter 1 to Quarter 4. This
suggests that customers have become less satisfied over time, which is a concerning trend. It's
essential to identify the root causes of this decline and address them to retain high levels of customer
satisfaction.
 The "Okay" category remained relatively stable over the four quarters, showing only minor variations
in percentages. This stability indicates that a consistent portion of customers had an average
experience throughout the year.
 In Quarter 4, there was a significant increase in the percentage of "Very Bad" and "Bad" feedback. At
the same time, the percentage of "Very Good" and "Good" feedback dropped compared to other
quarters. This sharp increase in negative feedback might indicate that the company faced challenges
in maintaining high customer satisfaction levels during this period. Potential reasons could include
issues with product quality, service delays, or other operational problem
 The combined percentage of "Very Bad" and "Bad" feedback increased over the quarters, particularly
in Quarter 4. This indicates that customer dissatisfaction has been rising, highlighting a potential issue
that needs to be addressed. The company should investigate the reasons behind this trend and take
corrective actions to improve customer satisfaction.

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 9
Question 6: What is the trend of the number of orders by quarter?

Solution Query:

SELECT

quarter_number AS quarter,

COUNT(order_id) AS number_of_orders

FROM

order_t

GROUP BY

quarter_number

ORDER BY

quarter_number;

Output:

Observations and Insights:

 The number of orders shows a decreasing trend over the quarters, indicating a potential drop in
customer demand or a seasonal pattern where certain quarters have historically lower purchase order
 The highest number of orders was observed in Quarter 1with 310 orders, and the lowest was in
Quarter 4with 199 orders
 There is a noticeable decline in orders from Quarter 1 to Quarter 4, suggesting a need for businesses
to analyze and address factors affecting purchase orders in the latter part of the year.

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 10
Question 7: Calculate the net revenue generated by the company.
What is the quarter-over-quarter % change in net revenue?

Solution Query:

WITH revenue AS (

SELECT

quarter_number AS quarter,

SUM(quantity * (vehicle_price - discount)) AS net_revenue

FROM

order_t

GROUP BY

quarter_number

SELECT

quarter,

net_revenue,

LAG(net_revenue) OVER (ORDER BY quarter) AS previous_revenue,

((net_revenue - LAG(net_revenue) OVER (ORDER BY quarter)) / LAG(net_revenue) OVER (ORDER BY


quarter)) * 100 AS qoq_change_pct

FROM

revenue;

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 11
Output:

Observations and Insights:

 There is a consistent quarter-over-quarter (QoQ) decline in net revenue, with negative percentages
ranging from -10.57% to -20.18%. This indicates a decreasing trend in the company's overall sales
performance over the analysed period.
 The largest drop in net revenue occurs in Quarter 4, with a QoQ change of -20.18%. This sharp
decline suggests that the company faced substantial challenges in maintaining revenue during this
period.

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 12
Question 8: What is the trend of net revenue and orders by
quarters?

Solution Query:

WITH quarterly_data AS (

SELECT

quarter_number AS quarter,

SUM(quantity * (vehicle_price - discount)) AS net_revenue,

COUNT(order_id) AS number_of_orders

FROM

order_t

GROUP BY

quarter_number

SELECT

quarter,

net_revenue,

number_of_orders

FROM

quarterly_data

ORDER BY

quarter;

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 13
Output:

Observations and Insights:

 There is a consistent decline in net revenue from Quarter 1 to Quarter 4. The net revenue
decreased from 39,637,378.16 in Quarter 1 to 23,495,814.14 in Quarter 4.
 Similarly, the number of orders decreased from 310 in Quarter 1 to 199 in Quarter 4. This
indicates a decline in customer demand or other factors affecting order volumes.

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 14
Question 9: What is the average discount offered for different
types of credit cards?

Solution Query:

SELECT

customer_t.credit_card_type,

ROUND(AVG(order_t.discount), 2) AS average_discount

FROM

order_t,

customer_t

WHERE

order_t.customer_id = customer_t.customer_id

GROUP BY customer_t.credit_card_type

ORDER BY average_discount DESC;

Output:

Observations and Insights:

• The average discounts range from 0.58 to 0.64, indicating that there are differences in the
discount rates across different credit card types
• The credit card type with the lowest average discount is "diners-club international “at 0.58, while
"laser" has the highest average discount at 0.64

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 15
Question 10: What is the average time taken to ship the placed
orders for each quarter?

Solution Query:

SELECT

quarter_number AS quarter,

ROUND(AVG(DATEDIFF(ship_date, order_date)), 2) AS average_shipping_time

FROM

order_t

GROUP BY

quarter_number

ORDER BY

quarter_number;

Output:

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 16
Observations and Insights:

• The average time to ship has increased over the quarters, with the highest average of 174 days in
quarter 4 and the lowest average of 57 days in quarter 1
• Quarter 4 has the longest average time to ship, indicating a potential issue or bottleneck in the
shipping process during that period
• There has been a significant jump in the average time to ship between quarter 3 (118 days) and
quarter 4 (174 days), suggesting a possible problem that arose in quarter 4
• The steepest increase in average time to ship occurred between quarter 2 (71 days) and quarter 3
(118 days), indicating a sudden slowdown in the shipping process during that period
• The lowest average time to ship was observed in quarter 1, which suggests that the shipping process
was more efficient during the beginning of the year

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 17
Business Metrics Overview

Total Revenue Total Orders Total Customers Average Rating

125.48M 1000 994 3.14

Last Quarter Revenue Last quarter Orders Average Days to Ship % Good Feedback

23.50M 199 98 44.1%

Business Recommendations
• Vehicle makers’ should address the issue of slow shipping to avoid customer dissatisfaction. This
could involve improving delivery services or exploring alternative shipping methods
• Temporarily increasing discounts and optimizing the shipping process may revert the decreasing
customer satisfaction
• Enhance ratings by ensuring vehicles are in good condition and focus on providing high-quality
services, such as fast delivery
• Need to create more demand for vehicle like Mercedes Benz, BMW, Toyota, Lexus, Jaguar
• Conduct online promotions and surveys to identify factors affecting sales in specific regions
• Develop effective strategies with finance companies offering credit cards to attract more customers
• Availability of preferred vehicle models locally could potentially expedite delivery services
• Focus sales on top sellers Chevrolet, Ford, Toyota, Pontiac, Dodge, Mercedes-Benz, Mazda,
Mitsubishi, Buick and GMC
• Shut down sales in states Vermont, Wyoming and Maine

Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 18

You might also like