← All SQL interview questions

Second highest invoice amount

MediumSubqueriesPayPalOracle

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

Practising alone only goes so far — our live cohorts pair SQL depth with dashboards, agentic analytics projects and mock interviews.

Explore the program