J.P. Morgan Interview Question

Questions were on building SQL queries