Operative Interview Question

CPP- 2 CODING QUESTION 2 sql query