Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Return Rate by Customer

Return each customer and the percentage of their orders that were returned, rounded to 2 decimals. Order by name.

Table schema

Customers(id INT PRIMARY KEY, name VARCHAR(10))
Orders(id INT PRIMARY KEY, customer_id INT, amount INT)
Returns(order_id INT, refund INT)

Sample data

Customers
id | name
1 | Ann
2 | Bob
3 | Cy

Orders
id | customer_id | amount
1 | 1 | 100
2 | 1 | 200
3 | 2 | 50
4 | 3 | 70

Returns
order_id | refund
2 | 200
4 | 30

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.