How do you ensure data integrity in your analysis at Faire?
Use the provided Faire order, order-line, and payment data to identify orders with inconsistent or missing financial records. Return only orders requiring investigation.
Output
- One row per problematic order.
- Include
order_id, order_total, line_total, completed_payment_total, and integrity_status.
- Treat missing order lines or completed payments as integrity issues, and sort by
order_id ascending.
Output details
- Calculate
line_total as the sum of quantity * unit_price for each order.
- Calculate
completed_payment_total as the sum of paid_amount for payments whose payment_status is completed.
- Mark every returned row with
integrity_status equal to INTEGRITY_ISSUE.
- Treat differing values, including one
NULL and one non-NULL, as inconsistent; treat two NULL values as equal.