Bitwise Interview Question

sql queries