Write SQL and Python, run instantly in your browser, and track your progress.
You are a Financial Analyst at Salesforce. The billing team needs to prioritize collections efforts by reviewing all outstanding invoices sorted by their payment deadlines.
Your task is to provide a list of all invoices with an unpaid balance, sorted by the soonest due date first.
| Column Name | Type |
|---|---|
| invoice_id | INTEGER |
| subscription_id | INTEGER |
| invoice_number | TEXT |
| period_start |
You are a Financial Analyst at Salesforce. The billing team needs to prioritize collections efforts by reviewing all outstanding invoices sorted by their payment deadlines.
Your task is to provide a list of all invoices with an unpaid balance, sorted by the soonest due date first.
| Column Name | Type |
|---|---|
| invoice_id | INTEGER |
| subscription_id | INTEGER |
| invoice_number | TEXT |
| period_start |
| TEXT |
| TEXT |
| period_end | TEXT |
| period_end | TEXT |
| issue_date | TEXT |
| issue_date | TEXT |
| due_date | TEXT |
| due_date | TEXT |
| status | TEXT |
| status | TEXT |
| subtotal_cents | INTEGER |
| subtotal_cents | INTEGER |
| tax_cents | INTEGER |
| tax_cents | INTEGER |
| discount_cents | INTEGER |
| discount_cents | INTEGER |
| total_cents | INTEGER |
| total_cents | INTEGER |
| amount_due_cents | INTEGER |
| amount_due_cents | INTEGER |
| amount_paid_cents | INTEGER |
| amount_paid_cents | INTEGER |
| currency | TEXT |
| currency | TEXT |
| invoice_id | subscription_id | invoice_number | period_start | period_end | issue_date | due_date | status | subtotal_cents | tax_cents | discount_cents | total_cents | amount_due_cents | amount_paid_cents |
|---|
| invoice_id | subscription_id | invoice_number | period_start | period_end | issue_date | due_date | status | subtotal_cents | tax_cents | discount_cents | total_cents | amount_due_cents | amount_paid_cents |
|---|
| invoice_id | subscription_id | invoice_number | due_date | amount_due_cents | status |
|---|---|---|---|---|---|
| 88 | 56 | INV-2025000088 | 2024-12-23 | 959603 | past_due |
| 87 | 55 | INV-2025000087 | 2024-12-25 | 507025 | open |
| 93 | 59 |
| invoice_id | subscription_id | invoice_number | due_date | amount_due_cents | status |
|---|---|---|---|---|---|
| 88 | 56 | INV-2025000088 | 2024-12-23 | 959603 | past_due |
| 87 | 55 | INV-2025000087 | 2024-12-25 | 507025 | open |
| 93 | 59 |
Showing first 5 of 23 rows. Unpaid invoices sorted by soonest due date.
Showing first 5 of 23 rows. Unpaid invoices sorted by soonest due date.
1. Output Columns:
2. Filtering:
3. Ordering:
1. Output Columns:
2. Filtering:
3. Ordering:
| currency |
|---|
| currency |
|---|
| 1 | 1 | INV-2025000001 | 2025-03-21 | 2025-04-19 | 2025-03-26 | 2025-04-25 | paid | 0 | 0 | 0 | 0 | 0 | 0 | USD |
| 2 | 1 | INV-2025000002 | 2025-04-20 | 2025-05-19 | 2025-04-20 | 2025-05-20 | open |
| 1 | 1 | INV-2025000001 | 2025-03-21 | 2025-04-19 | 2025-03-26 | 2025-04-25 | paid | 0 | 0 | 0 | 0 | 0 | 0 | USD |
| 2 | 1 | INV-2025000002 | 2025-04-20 | 2025-05-19 | 2025-04-20 | 2025-05-20 | open |
| INV-2025000093 |
| INV-2025000093 |
| 2025-02-16 |
| 2025-02-16 |
| 153133 |
| 153133 |
| past_due |
| past_due |
| 14 | 6 | INV-2025000014 | 2025-04-14 | 416658 | draft |
| 14 | 6 | INV-2025000014 | 2025-04-14 | 416658 | draft |
| 53 | 31 | INV-2025000053 | 2025-05-17 | 875026 | past_due |
| 53 | 31 | INV-2025000053 | 2025-05-17 | 875026 | past_due |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| USD |
| USD |
| 3 | 1 | INV-2025000003 | 2025-05-20 | 2025-06-18 | 2025-05-23 | 2025-06-07 | paid | 0 | 0 | 0 | 0 | 0 | 0 | USD |
| 3 | 1 | INV-2025000003 | 2025-05-20 | 2025-06-18 | 2025-05-23 | 2025-06-07 | paid | 0 | 0 | 0 | 0 | 0 | 0 | USD |
| 4 | 2 | INV-2025000004 | 2025-04-24 | 2025-05-23 | 2025-04-24 | 2025-05-24 | past_due | 537900 | 53790 | 0 | 591690 | 339860 | 251830 | USD |
| 4 | 2 | INV-2025000004 | 2025-04-24 | 2025-05-23 | 2025-04-24 | 2025-05-24 | past_due | 537900 | 53790 | 0 | 591690 | 339860 | 251830 | USD |
| 5 | 2 | INV-2025000005 | 2025-05-24 | 2025-06-22 | 2025-05-25 | 2025-06-09 | paid | 537900 | 0 | 0 | 537900 | 0 | 537900 | USD |
| 5 | 2 | INV-2025000005 | 2025-05-24 | 2025-06-22 | 2025-05-25 | 2025-06-09 | paid | 537900 | 0 | 0 | 537900 | 0 | 537900 | USD |