Write a SQL query with some tricky joins (HackerRank SQL question).
Asked in the HackerRank online test stage. Using the provided customers, orders, and payments tables, return customers with at least one order dated on or after 2025-01-01. Include successful payment totals while retaining qualifying orders that have no successful payment.
Output
- One row per qualifying customer with
customer_id, customer_name, order_count, and successful_payment_amount.
- Sort by
successful_payment_amount descending, then customer_id ascending.