Valtech Interview Question

SQL query like joins functions