Noom interview question

SQL joins, subqueries. Java coding