Vonage Interview Question

SQL query to get the data