Vonage interview question

SQL query to get the data