select n,n and 3,n & 3, n mod 4, n and false,n and true from (select 0 n union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select null) v1; +------+-------+------+-------+-------+-------+ | n | n and | n & | n mod | n and | n and | | | 3 | 3 | 4 | false | true | +------+-------+------+-------+-------+-------+ | 0 | 0 | 0 | 0 | 0 | 0 | | 1 | 1 | 1 | 1 | 0 | 1 | | 2 | 1 | 2 | 2 | 0 | 1 | | 3 | 1 | 3 | 3 | 0 | 1 | | 4 | 1 | 0 | 0 | 0 | 1 | | 5 | 1 | 1 | 1 | 0 | 1 | | 6 | 1 | 2 | 2 | 0 | 1 | | 7 | 1 | 3 | 3 | 0 | 1 | | NULL | NULL | NULL | NULL | 0 | NULL | +------+-------+------+-------+-------+-------+ 9 rows in set (0.00 sec)
And, did you get it right?
“3″ is a true value, that makes “n and true” and “n and 3″ the same. The modulo and bit-operations are obvious and so is the fact, that an operation with NULL results in NULL.
For me the most interesting part is, that TRUE AND NULL is NULL, where as FALSE AND NULL is FALSE.