J.P. Morgan interview question

2 SQL query