SQL Puzzle – A Quick Fun with Bit Wise Operator

It has been a long time since we have puzzle on this blog so let us have a quick puzzle this Friday. It is based on Bit Wise Operator and very simple if you know those operators.

We will guess the output of the SQL script.

For example, here is the select statement:

SELECT 10 & 10

SQL Puzzle - A Quick Fun with Bit Wise Operator bitwisezero

Upon executing it will return us answer as a 10.

However, when I execute following two queries, both of the queries give an answer as Zero.

SELECT 10 & 0;
SELECT 1 & 100;

SQL Puzzle - A Quick Fun with Bit Wise Operator bitwisezero1

Here is the question for you – why is it giving answers as zero? Please leave your answer in a comment below.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Previous Post
SQL SERVER – Learning SSIS – Where Do I Start? – Notes from the Field #014
Next Post
SQL Puzzle – A Quick Fun with Bit Wise Operator – Part 2

Related Posts

No results found.

Leave a Reply