Bitwise Interview Question

SQL queries on joins.