Bitwise Interview Question

SQL quires