Bitwise interview question

SQL queries on joins.