0% found this document useful (0 votes)
26 views8 pages

Archa e S Business Report SQL 12 Jul 24

SQL

Uploaded by

Archa E S
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)
26 views8 pages

Archa e S Business Report SQL 12 Jul 24

SQL

Uploaded by

Archa E S
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/ 8

SQL BUSINESS REPORT

DSBA

SUBMITTED BY
ARCHA E S
Contents
Table of Figures ................................................................................................................................. 4
Project Problem Statement ............................................................................................................... 5
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: ..................................................................... 5
i. If customer creation date year <2005 then category a ............................................................... 5
ii. If customer creation date year >=2005 and <2011 then category b........................................... 5
iii. If customer creation date year>= 2011 then category c ........................................................... 5
Hint: Use case statement, no permanent change in table required. [note: tables to be used -
online_customer table .................................................................................................................. 5
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. .................. 5
i. If product price > 20,000 then apply 20% discount..................................................................... 5
ii. If product price > 10,000 then apply 15% discount .................................................................... 5
iii. If product price =< 10,000 then apply 10% discount ................................................................. 5
Hint: use case statement, no permanent change in table required. [note: tables to be used -
product, order_items table] .......................................................................................................... 5
Output: ......................................................................................................................................... 5
3. Write a query to display product_class_code, product_class_description, count of product
type in each product class, and inventory value (p. product_quantity_avail*p. product_price).
Information should be displayed for only those product_class_code that have more than
1,00,000 inventory value. sort the output concerning the decreasing value of inventory_value. . 6
[note: tables to be used -product, product_class] ......................................................................... 6
4. Write a query to display customer_id, full name, customer_email, customer_phone and
country of customers who have cancelled all the orders placed by them (use sub-query) ....... 6
[note: tables to be used - online_customer, addresss, order_header] .......................................... 6
5. Write a query to display shipper name, city to which it is catering, number of customers
catered by the shipper in the city and number of consignments delivered to that city for shipper
dhl................................................................................................................................................. 6
[note: tables to be used -shipper, online_customer, addresss, order_header] ............................. 6
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'
...................................................................................................................................................... 7
[note: tables to be used -online_customer, order_items, product, order_header] ....................... 7
7. Write a query to display order_id and volume of biggest order (in terms of volume) that can
fit in carton id 10 -- [note: tables to be used -carton, order_items, product] ................................ 7
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: .................................... 7
a. For electronics and computer categories, ................................................................................. 7
i. If sales till date is zero then show 'no sales in past, give discount to reduce inventory',............ 7
ii. If inventory quantity is less than 10% of quantity sold, show 'low inventory, need to add
inventory',..................................................................................................................................... 7
iii. If inventory quantity is less than 50% of quantity sold, show 'medium inventory, need to add
some inventory', ........................................................................................................................... 7
iv. If inventory quantity is more or equal to 50% of quantity sold, show 'sufficient inventory' .... 7
b. For mobiles and watches categories, ........................................................................................ 7
i. If sales till date is zero then show 'no sales in past, give discount to reduce inventory',............ 7
ii. If inventory quantity is less than 20% of quantity sold, show 'low inventory, need to add
inventory',..................................................................................................................................... 7
iii. If inventory quantity is less than 60% of quantity sold, show 'medium inventory, need to add
some inventory', ........................................................................................................................... 7
iv. If inventory quantity is more or equal to 60% of quantity sold, show 'sufficient inventory' .... 7
c. Rest of the categories, ............................................................................................................... 7
i. If sales till date is zero then show 'no sales in past, give discount to reduce inventory',............ 7
ii. If inventory quantity is less than 30% of quantity sold, show 'low inventory, need to add
inventory',..................................................................................................................................... 7
iii. If inventory quantity is less than 70% of quantity sold, show 'medium inventory, need to add
some inventory', ........................................................................................................................... 7
iv. If inventory quantity is more or equal to 70% of quantity sold, show 'sufficient inventory' .... 7
[note: tables to be used -product, product_class, order_items] (use sub-query) .......................... 7
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) ........................................... 8
[note: tables to be used -order_items, product, order_header, online_customer, address] ......... 8
10. Write a query to display the order_id, customer_id and customer full name and total
quantity of products shipped for order ids which are even and shipped to address where pin
code is not starting with "5" ......................................................................................................... 8
[note: tables to be used - online_customer, order_header, order_items, address] ...................... 8
Table of Figures
Table 1: OUTPUT (QUERY 1) .............................................................................................................. 5
Table 2: OUTPUT (QUERY 2) .............................................................................................................. 5
Table 3: OUTPUT (QUERY 3) .............................................................................................................. 6
Table 4: OUTPUT (QUERY 3) .............................................................................................................. 6
Table 5: OUTPUT (QUERY 4) .............................................................................................................. 6
Table 6: OUTPUT (QUERY 6) .............................................................................................................. 7
Table 7: OUTPUT (QUERY 7) .............................................................................................................. 7
Table 8: OUTPUT (QUERY 8) .............................................................................................................. 8
Table 9: OUTPUT (QUERY 9) .............................................................................................................. 8
Table 10: OUTPUT (QUERY 10) ........................................................................................................... 8
Project Problem Statement
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.

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:
i. If customer creation date year <2005 then category a
ii. If customer creation date year >=2005 and <2011 then category b
iii. If customer creation date year>= 2011 then category c
Hint: Use case statement, no permanent change in table required. [note: tables to be used -
online_customer table

Output
TABLE 1: OUTPUT (QUERY 1)

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.
i. If product price > 20,000 then apply 20% discount
ii. If product price > 10,000 then apply 15% discount
iii. If product price =< 10,000 then apply 10% discount
Hint: use case statement, no permanent change in table required. [note: tables to be used -
product, order_items table]

Output:
TABLE 2: OUTPUT (QUERY 2)
3. Write a query to display product_class_code, product_class_description, count of product type
in each product class, and inventory value (p. product_quantity_avail*p. product_price).
Information should be displayed for only those product_class_code that have more than 1,00,000
inventory value. sort the output concerning the decreasing value of inventory_value.
[note: tables to be used -product, product_class]

Output:

TABLE 3: OUTPUT (QUERY 3)

4. Write a query to display customer_id, full name, customer_email, customer_phone and country
of customers who have cancelled all the orders placed by them (use sub-query)
[note: tables to be used - online_customer, addresss, order_header]

Output:

TABLE 4: OUTPUT (QUERY 3)

5. Write a query to display shipper name, city to which it is catering, number of customers catered
by the shipper in the city and number of consignments delivered to that city for shipper dhl
[note: tables to be used -shipper, online_customer, addresss, order_header]

Output:

TABLE 5: OUTPUT (QUERY 4)


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'
[note: tables to be used -online_customer, order_items, product, order_header]

Output:

TABLE 6: OUTPUT (QUERY 6)

7. Write a query to display order_id and volume of biggest order (in terms of volume) that can fit
in carton id 10 -- [note: tables to be used -carton, order_items, product]

Output:

TABLE 7: OUTPUT (QUERY 7)

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:
a. For electronics and computer categories,
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'
b. For mobiles and watches categories,
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'
c. Rest of the categories,
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'
[note: tables to be used -product, product_class, order_items] (use sub-query)
Output:

TABLE 8: OUTPUT (QUERY 8)

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)
[note: tables to be used -order_items, product, order_header, online_customer, address]

Output:

TABLE 9: OUTPUT (QUERY 9)

10. Write a query to display the order_id, customer_id and customer full name and total quantity
of products shipped for order ids which are even and shipped to address where pin code is not
starting with "5"
[note: tables to be used - online_customer, order_header, order_items, address]

Output:

TABLE 10: OUTPUT (QUERY 10)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy