SQL Project Business Report
SQL Project Business Report
GREAT LEARNING
Page 1 of 22
Contents
Project Problem Statement ............................................................................................ 2
ER DIAGRAM................................................................................................................. 3
Problem 1 ..................................................................................................................... 4
Problem 2 ..................................................................................................................... 6
Problem 3 ..................................................................................................................... 8
Problem 4 ................................................................................................................... 10
Problem 5 ................................................................................................................... 11
Problem 6 ................................................................................................................... 13
Problem 7 ................................................................................................................... 15
Problem 8 ................................................................................................................... 16
Problem 9 ................................................................................................................... 19
Problem 10 ................................................................................................................. 21
Page 2 of 22
You are hired by a chain of online retail stores “Reliant retail limited”.
They provide you with “orders” database and seek answers to the
following queries as the results from these queries will help the company
in making data-driven decisions that will impact the overall growth of the
online retail store.
ER DIAGRAM
Page 4 of 22
Problem 1
Write a query to display customer full name with their title (mr/ms), both first name and
last name are in upper case with customer email id, customer creation date and
display customer’s category after applying below categorization rules:
ii. If customer creation date year >=2005 and <2011 then category b
Hint: Use case statement, no permanent change in table required. [note: tables to be
used -online_customer table]
SOLUTION
The goal of this query is to display the full name of customers, including their title (Mr./Ms.),
along with their email ID, creation date, and customer category based on the year of their
creation date.
SAMPLE OUTPUT
Page 5 of 22
BUSINESS INSIGHTS
RECOMMENDATIONS
Problem 2
Write a query to display the following information for the products, which have not been
sold: product_id, product_desc, product_quantity_avail, product_price, inventory
values(product_quantity_avail*product_price), new_price after applying discount as per
the below criteria. Sort the output concerning the decreasing value of inventory_value.
Hint: use case statement, no permanent change in table required. [note: tables to be
used -product, order_items table]
SOLUTION
The goal of this query is to retrieve details of products that have not been sold, including
product ID, description, quantity available, price, inventory value, and the new price after
applying discounts based on specific criteria.
SAMPLE OUTPUT
Page 7 of 22
BUSINESS INSIGHTS
RECOMMENDATIONS
Problem 3
SOLUTION
The goal of this query is to provide insights into product classes that hold significant
inventory value and the count of products within each class.
SAMPLE OUTPUT
Page 9 of 22
BUSINESS INSIGHTS
• Analyzing product classes with high inventory values can help in strategic decision-
making regarding stock management and marketing efforts.
• Understanding product counts within classes can aid in identifying potential
overstock issues or trends in consumer preferences.
RECOMMENDATIONS
• Inventory Management: Focus on optimizing inventory for classes with high values
to minimize holding costs and avoid stockouts.
Problem 4
SOLUTION
The goal of this query is to identify customers who have completely canceled their orders
and retrieve their details for potential follow-up or analysis.
SAMPLE OUTPUT
BUSINESS INSIGHTS
• Understanding why these customers have canceled their orders can help improve
customer retention strategies. It can also highlight potential issues in service or
product quality.
RECOMMENDATIONS
• Quality Analysis: Analyze the common reasons for order cancellations and address
them to improve overall customer satisfaction.
Page 11 of 22
• Marketing Strategy: Target these customers with specific campaigns to win them
back, perhaps offering incentives for their next order.
Problem 5
Write a query to display shipper name, city to which it is catering, number of customer
catered by the shipper in the city and number of consignments delivered to that city for
shipper dhl
SOLUTION
The goal of this query is to gather information about the shipper "DHL" to analyze its
customer base and delivery performance in various cities.
SAMPLE OUTPUT
Page 12 of 22
BUSINESS INSIGHTS
• Understanding customer reach and the volume of consignments delivered can help
DHL identify successful regions and areas needing improvement.
RECOMMENDATIONS
• Market Expansion: If certain cities have low customer counts, consider marketing
efforts to attract more customers in those areas.
Problem 6
Write a query to display customer id, customer full name, total quantity and total value
(quantity*price) shipped where mode of payment is cash and customer last name starts
with 'g'
SOLUTION
The goal of this query is to analyze customer orders that were paid for in cash, specifically
focusing on customers whose last names start with the letter 'G'.
SAMPLE OUTPUT
Page 14 of 22
BUSINESS INSIGHTS
RECOMMENDATIONS
Problem 7
Write a query to display order_id and volume of biggest order (in terms of volume) that can
fit in carton id 10
SOLUTION
The purpose of this query is to determine the order ID and the volume of the largest order
that can fit within a specific carton (ID 10).
SAMPLE OUTPUT
BUSINESS INSIGHTS
RECOMMENDATIONS
• Optimizing Packing: Use the results to optimize the packing process for large
orders.
• Inventory Planning: Consider how many large orders can be fulfilled with the
available carton sizes and adjust inventory levels accordingly.
• Analyzing Volume Trends: Monitor order volume trends to enhance forecasting and
manage storage space effectively.
Page 16 of 22
Problem 8
Write a query to display product_id, product_desc, product_quantity_avail, quantity sold,
and show inventory status of products as below as per below condition:
i. If sales till date is zero then show 'no sales in past, give discount to reduce inventory',
ii. If inventory quantity is less than 10% of quantity sold, show 'low inventory, need to add
inventory',
iii. If inventory quantity is less than 50% of quantity sold, show 'medium inventory, need
to add some inventory',
iv. If inventory quantity is more or equal to 50% of quantity sold, show 'sufficient
inventory'
i. If sales till date is zero then show 'no sales in past, give discount to reduce inventory',
ii. If inventory quantity is less than 20% of quantity sold, show 'low inventory, need to add
inventory',
iii. If inventory quantity is less than 60% of quantity sold, show 'medium inventory, need
to add some inventory',
iv. If inventory quantity is more or equal to 60% of quantity sold, show 'sufficient
inventory'
i. If sales till date is zero then show 'no sales in past, give discount to reduce inventory',
ii. If inventory quantity is less than 30% of quantity sold, show 'low inventory, need to add
inventory',
iii. If inventory quantity is less than 70% of quantity sold, show 'medium inventory, need
to add some inventory',
iv. If inventory quantity is more or equal to 70% of quantity sold, show 'sufficient
inventory'
Page 17 of 22
SOLUTION
The purpose of this report is to analyze the inventory status of various products in our
catalog, focusing on sales performance and current inventory levels. By categorizing
products based on their sales and inventory data, we aim to identify potential inventory
issues and suggest actions for improvement.
SAMPLE OUTPUT
Page 18 of 22
BUSINESS INSIGHTS
• Zero Sales Products: A significant number of products have not sold, indicating
potential issues with product selection, pricing, or marketing.
• Low Inventory Risks: Some items are nearing critical inventory levels, which could
lead to stockouts and lost sales.
• Categorical Differences: Variability in sales and inventory trends across product
classes suggests the need for tailored strategies.
RECOMMENDATIONS
o Market Research: Investigate reasons for low sales and consider revising
marketing strategies.
Problem 9
Write a query to display product_id, product_desc and total quantity of products which are
sold together with product id 201 and are not shipped to city bangalore and new delhi.
Display the output in descending order concerning tot_qty.(use sub-query)
SOLUTION
The objective of the query is to identify and analyze products that are sold together with
product ID 201, excluding orders shipped to the cities of Bangalore and New Delhi.
SAMPLE OUTPUT
Page 20 of 22
BUSINESS INSIGHTS
1. Sales Performance: The query highlights products frequently sold together with
product ID 201, providing insight into popular product combinations. This helps
identify complementary products that customers tend to purchase together.
2. Geographical Preferences: Excluding Bangalore and New Delhi from the sales data
reveals customer purchasing patterns in other cities. This can help in targeting and
optimizing product offerings outside of these major cities.
RECOMMENDATIONS
2. Regional Marketing: Since sales are excluded from Bangalore and New Delhi, focus
on marketing and promotional activities in other regions to boost sales in less
targeted cities.
3. Optimized Stocking: Use the data to adjust stock levels for frequently sold-together
products, preventing stockouts and improving overall customer satisfaction.
Page 21 of 22
Problem 10
Write a query to display the order_id,customer_id and customer fullname and total
quantity of products shipped for order ids which are even and shipped to address where
pincode is not starting with "5"
SOLUTION
The objective of this query is to identify and analyze the orders placed by customers with
even order_ids, specifically focusing on those shipped to addresses where the pincode
does not start with "5".
SAMPLE OUTPUT
Page 22 of 22
BUSINESS INSIGHTS
1. Customer Behavior: Analyzing the orders with even order_ids may reveal patterns
or preferences among customers, such as seasonal buying trends or specific
product interests linked to these orders.
2. Geographical Distribution: The restriction on pincodes not starting with "5" might
indicate targeting specific regions, thus understanding geographical sales trends
and customer bases.
3. Product Demand: The total quantity of products shipped can help gauge which
products are in demand among customers in these regions, aiding in inventory
planning and stock management.
4. Customer Profile: Identifying the customers associated with these orders provides
insights into who the key buyers are, which can inform future marketing and sales
strategies.
RECOMMENDATIONS