Payrails interview question

SQL question to join databases and provide a specific output