XYZ interview question

Write sql query for joins