JPMorganChase Interview Question

Write a string in SQL to obtain a query