BP Wealth interview question

Query for SQL