Bitwise interview question

SQL queries