Customers whose every order is fully paid

SQL Hard 3 views
Back to Questions

Problem Description

Return customers for which there is no order with unpaid balance. Unpaid means Orders.total_amount > sum(Payments.amount).

Input Format

SQL query

Output Format

Result set

Sample Test Case

Input:
Orders, Payments
Output:
Customer list

Constraints

Use NOT EXISTS on unpaid orders

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev