OnRamp interview question

Specific queries to the database based on expected output