Forum Discussion
Sathish_Kumar_Godugu
Jan 21, 2024Copper Contributor
Help me to write query for below
How many total orders were there in each month and how many of them were
returned? Add a column for return rate too.
return rate = (100.0 * total return orders) / total buy orders
Hint: You will need to combine SUM() with CASE WHEN
Database Description:
Customers: Contains customer information, including cust_id, first_name, last_name,
email, phone, primary_pincode, gender, dob, joining_date.
Products: Contains product information, including product_id, product_name, brand,
category, procurement_cost_per_unit, mrp.
Pincode: Contains pincode-related information, including the pincode, city and state.
Delivery Person: Contains information about delivery personnel, including
delivery_person_id, name, joining_date, pincode
Orders: Contains order details, including order_id, order_type, cust_id, order_date,
delivery_date,
tot_units,
displayed_selling_price_per_unit,
product_id, delivery_person_id, payment_type, delivery_pincode
- olafhelperBronze Contributor
Database Description:
Sathish_Kumar_Godugu , homework? Homework is for learning.
And that "description" isn't really one.
Please post table design as DDL, some sample data as DML statement and the expected result.