> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators.md).

# Bit Functions and Operators

- [BIT\_COUNT](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bit_count.md): Count the set bits. This function returns the number of bits that are set to 1 in the binary representation of a number.
- [~](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-not.md): Invert all bits. This unary operator flips every bit in the operand, changing 1s to 0s and 0s to 1s.
- [|](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-or.md): Perform bitwise OR. This operator compares bits and returns 1 if at least one of the corresponding bits is 1.
- [^](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise-xor.md): Perform bitwise exclusive OR. This operator returns 1 only if the corresponding bits of the operands are different.
- [&](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/bitwise_and.md): Perform bitwise AND. This operator compares bits of two operands and returns 1 only if both corresponding bits are 1.
- [Parentheses](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/parentheses.md): Control operator precedence. Parentheses are used to group expressions and enforce the order of evaluation in complex operations.
- [<<](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/shift-left.md): Shift bits to the left. This operator shifts the binary representation of a number to the left by a specified number of positions, filling with zeros.
- [>>](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/shift-right.md): Shift bits to the right. This operator shifts the binary representation of a number to the right by a specified number of positions.
- [TRUE FALSE](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/true-false.md): Boolean literal for 1 = TRUE or 0 = FALSE, respectively.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
