0% found this document useful (0 votes)
12 views3 pages

Weekday vs. Weekend Payment Analysis

Uploaded by

Nikhil Verma
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)
12 views3 pages

Weekday vs. Weekend Payment Analysis

Uploaded by

Nikhil Verma
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

KPI 1: Weekday vs.

Weekend Payment Statistics

A. Total Orders: Weekday vs. Weekend

This query aims to di erentiate the number of total orders placed on weekdays versus weekends. It
begins by using a SELECT statement with a CASE expression to classify each order based on the day
of the week. Specifically, it uses the DAYOFWEEK() function to extract the day from the
order_purchase_timestamp, which is converted into a date format using STR_TO_DATE() to match the
expected date format ('%d-%m-%Y'). The DAYOFWEEK() function returns values ranging from 1
(Sunday) to 7 (Saturday). If the extracted day corresponds to any of the days from Monday to Friday
(represented by numbers 2 through 6), the CASE statement labels it as "Weekday." Otherwise, it labels
it as "Weekend." The query then counts the total number of orders (COUNT(order_id)) for each
category and groups the results by Day (either "Weekday" or "Weekend").

B. Average Payment Value: Weekday vs. Weekend

This query calculates the average payment value for orders placed on weekdays and weekends.
Similar to the previous query, it uses a CASE statement to classify orders into "Weekday" and
"Weekend" based on the DAYOFWEEK() function. The STR_TO_DATE() function ensures that the
order_purchase_timestamp is interpreted correctly as a date. The JOIN operation links the
olist_orders_dataset table with the olist_order_payments_dataset table using order_id to access
payment information. It then calculates the average payment value for each category using
AVG(p.payment_value). The average is formatted to two decimal places with the FORMAT() function
and prefixed with "R$" for Brazilian Reais currency representation. Finally, the results are grouped by
the Day to distinguish between weekdays and weekends.

KPI 2: Total Number of Orders with Review Score 5 and Payment Type as Credit Card

This query identifies the total number of orders that received a 5-star review and were paid for using a
credit card. It first performs a JOIN operation between the olist_order_reviews_dataset,
olist_orders_dataset, and olist_order_payments_dataset tables using order_id as the common key.
This allows access to review scores and payment information. The WHERE clause filters the results to
include only those orders that have a review score of 5 and a payment type of "credit_card." The query
then counts the distinct order_ids that meet these criteria to determine the total number of such
orders.

KPI 3: Average Delivery Days for Pet Shop Products

This query calculates the average number of days it takes to deliver products from the "pet_shop"
category. It begins by performing a JOIN between the olist_order_items_dataset,
olist_products_dataset, and olist_orders_dataset tables, using the product_id and order_id keys to
access product categories and order dates. The WHERE clause ensures that only orders with a valid
delivery date are considered and filters for products specifically from the "pet_shop" category. The
DATEDIFF() function calculates the di erence in days between the order_delivered_customer_date
and the order_purchase_timestamp. The average delivery days are then computed using AVG() and
rounded to zero decimal places with ROUND() to present a clear average.

KPI 4: Average Price and Payment Values from Customers of São Paulo
This query calculates the average price of items and the average payment value for orders placed by
customers from São Paulo. It uses two subqueries. The first subquery calculates the average price of
products ordered by São Paulo customers by joining the olist_customers_dataset,
olist_orders_dataset, and olist_order_items_dataset tables. The WHERE clause ensures the selection
of customers specifically from São Paulo (customer_city = 'sao paulo' and customer_state = 'SP'). The
average price is calculated and formatted as Brazilian currency. The second subquery computes the
average payment value using similar conditions and joins with the olist_order_payments_dataset for
payment information. The results of these subqueries are combined to provide both average price and
average payment values.

KPI 5: Relationship Between Shipping Days vs. Review Scores

This query explores the relationship between the time taken to deliver orders and the review scores
given by customers. It starts by joining the olist_order_reviews_dataset with the olist_orders_dataset
using order_id. The DATEDIFF() function calculates the di erence between the delivery date
(order_delivered_customer_date) and the order purchase date (order_purchase_timestamp),
representing the number of shipping days. The average of these shipping days is then computed for
each review score using AVG() and rounded to zero decimal places for a more intuitive representation.
The results are grouped and ordered by review_score, allowing analysis of how shipping times might
impact customer reviews.

KPI 6: Total Orders, Price, Freight Value, and Total Amount

This query provides a summary of financial metrics, including total orders, the total price of items,
total freight charges, and the overall amount. It calculates the total number of orders using
COUNT(order_id) and the total price and freight values using SUM(price) and SUM(freight_value),
respectively, from the olist_order_items_dataset. The values are divided by 1,000,000 and formatted
to show amounts in millions (M) with ROUND() and CONCAT() functions, making the figures more
readable and suitable for high-level analysis.

KPI 7: Most Used Payment Type

This query identifies the most common payment methods used by customers. It retrieves payment
data from the olist_order_payments_dataset and groups it by payment_type to determine the number
of occurrences for each type. Using COUNT(order_id), it calculates the total number of payments for
each payment method, making it possible to identify the most frequently used option.

KPI 8: Yearly Approved Orders

This query provides a year-by-year breakdown of approved orders. It extracts the year from the
order_approved_at timestamp using the YEAR() function and ensures the date is correctly parsed with
STR_TO_DATE() in the format '%d-%m-%Y'. It then counts the total number of orders
(COUNT(order_id)) for each year and groups the results by Year. The ORDER BY clause sorts the
results chronologically.

KPI 9: Top 5 Product Categories with Most 5-Star Reviews

This query lists the top 5 product categories that have received the most 5-star reviews. It joins the
olist_order_items_dataset, olist_order_reviews_dataset, and olist_products_dataset using the
order_id and product_id keys to link reviews to specific products. It then filters the results to include
only reviews with a score of 5. The number of such reviews is counted for each product category using
COUNT(r.review_score), and the results are grouped by product_category_name. Finally, the query
sorts the categories in descending order of review count and limits the output to the top 5.

KPI 10: Top 5 Product Categories with Most 1-Star Reviews

This query is similar to the previous one but focuses on 1-star reviews instead of 5-star reviews. It
identifies the product categories that received the most 1-star reviews by joining the same tables and
filtering for review_score = 1. The results are counted, grouped by product category, sorted in
descending order of review count, and limited to the top 5 categories, helping identify product areas
with potentially lower customer satisfaction.

Common questions

Powered by AI

By examining the relationship between shipping days and review scores, businesses can glean insights into how delivery times impact customer satisfaction and subsequently, review scores. Analyzing this relationship helps e-commerce companies understand whether longer delivery times correlate with lower satisfaction, as reflected by review scores. These insights are critical for businesses to refine their logistics and improve delivery times, thereby possibly enhancing customer satisfaction and reducing negative feedback that could affect future sales. The use of DATEDIFF() to quantify shipping times is central to this analysis .

Identifying product categories with the most 1-star reviews is crucial for pinpointing areas where customer dissatisfaction is prevalent. This analysis allows businesses to address underlying issues such as product quality, performance, or customer service related to these categories. By understanding the reasons behind low reviews, companies can undertake corrective measures to improve products and services, thereby potentially increasing customer satisfaction and reducing negative feedback. Focused interventions in these identified categories can lead to better overall service quality and enhanced customer experiences .

Identifying the most used payment type helps businesses tailor their services and marketing strategies to better meet customer preferences and streamline transaction processes. By knowing which payment method is most popular, businesses can ensure that their platforms emphasize ease of use for that payment type, potentially reducing friction during the checkout process. Furthermore, this knowledge can inform promotional campaigns and customer engagement initiatives that align with popular payment preferences, potentially driving higher sales and customer retention .

Analyzing yearly approved orders is significant as it provides a temporal perspective on business performance and customer trends. This analysis can reveal growth patterns, seasonal variances, and market expansion or contraction insights over time. By examining data on an annual basis, businesses can identify long-term trends, assess the impact of strategic changes, and adjust their approaches in response to observed patterns. Such analyses are essential for strategic planning and forecasting, helping businesses remain competitive and responsive to market conditions .

The classification of orders by day of the week allows the analysis to discern patterns in customer behavior and payment values linked to specific times of the week. By using DAYOFWEEK() to determine if an order falls on a 'Weekday' (Monday to Friday) or 'Weekend' (Saturday and Sunday), it enables the computation of metrics such as the total number of orders and average payment value separately for these periods. This distinction is crucial in identifying potential variations in consumer spending habits and preferences based on whether they shop during the week or the weekend .

Presenting financial metrics such as total orders, price, and freight value in units of millions simplifies the data, making it more palatable and easier to interpret for high-level analysis. This choice enhances readability and comprehension, especially when dealing with large datasets and significant values that would otherwise be cumbersome if represented in their raw form. By rounding and concatenating values with 'M', stakeholders and decision-makers can quickly grasp the scale and magnitude of the financial metrics being analyzed .

Calculating the average delivery days for pet shop products provides insights into the efficiency and reliability of the supply chain specific to this category. By measuring the time between order purchase and customer delivery, businesses can assess whether delivery time meets customer expectations and industry standards. This evaluation helps in identifying bottlenecks or inefficiencies in the delivery process that could be optimized to improve customer satisfaction and operational efficiency. The DATEDIFF() function plays a crucial role in quantifying these delivery timelines .

Using subqueries to calculate the average price and payment values for São Paulo customers allows for a precise and targeted analysis that filters data based on specific selection criteria. Subqueries enable the isolation of relevant data pertaining to São Paulo customers by extracting and averaging only the pertinent transactions using conditions specific to the customer location. This approach ensures that extraneous data from other regions does not skew the results, thus enhancing the accuracy and relevance of the financial metrics being analyzed for this customer demographic .

The top 5 product categories receiving the most 5-star reviews indicate areas where current products are most successful in meeting customer expectations. This information can guide product development by highlighting features, quality, and customer service aspects that lead to high satisfaction. In marketing, focusing on these categories can enhance brand reputation and customer loyalty by promoting products that have demonstrably earned customer approval. Leveraging positive customer feedback from these categories can also inform promotional strategies aimed at increasing brand visibility and attracting new customers .

Filtering for orders with a 5-star review and paid via credit card allows the analysis to target transactions that likely represent high customer satisfaction, correlating it with the preferred payment method, in this case, credit cards. By focusing on this group, the query can deduce the role of the payment type in achieving high satisfaction scores. This information can be used to infer consumer trust and satisfaction with both the purchasing process and the product when credit cards are used, which may guide marketing strategies and payment processing improvements .

You might also like