Bloomberg interview question

Write a SQL query with criterion where if there is this table and other table