A billing dashboard shows the runner-up invoice as a sanity check against the largest one.
From invoices, return a single column second_highest_amount containing the second highest distinct amount. If fewer than two distinct amounts exist the query should return NULL rather than no rows.
Sample data
More Subqueries questions
Practising alone only goes so far — our live cohorts pair SQL depth with dashboards, agentic analytics projects and mock interviews.
Explore the program