BIT_AND( )

This MySQL function returns the bitwise AND for all bits for the expression given. I'll confess here: I really have no idea what this does, although I wrote something about it. I just don't get these bitwise functions. So please let me know what they do if you know.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

BIT_AND(expression)

Explanation

This function returns the bitwise AND for all bits for the expression given. Use this in conjunction with the GROUP BY clause. The function has a 64-bit precision. If there are no matching rows, before version 4.0.17 of MySQL, a -1 is returned. Newer versions return 18446744073709551615, which is the value of 1 for all bits of an unsigned BIGINT column.