JPMorganChase interview question

Write a string in SQL to obtain a query