diff --git a/docs/.vuepress/sidebar/en.js b/docs/.vuepress/sidebar/en.js index 6053ae479d..868958b5d6 100644 --- a/docs/.vuepress/sidebar/en.js +++ b/docs/.vuepress/sidebar/en.js @@ -435,6 +435,16 @@ module.exports = [ "orthogonal_bitmap_union_count", ], }, + { + title: "bitwise function", + directoryPath: "bitwise-functions/", + children: [ + "bitand", + "bitor", + "bitxor", + "bitnot" + ], + }, { title: "Encryption and Digest Functions", directoryPath: "encrypt-digest-functions/", diff --git a/docs/.vuepress/sidebar/zh-CN.js b/docs/.vuepress/sidebar/zh-CN.js index ccbf8cbd23..1f173eb08f 100644 --- a/docs/.vuepress/sidebar/zh-CN.js +++ b/docs/.vuepress/sidebar/zh-CN.js @@ -439,6 +439,16 @@ module.exports = [ "orthogonal_bitmap_union_count", ], }, + { + title: "bitwise函数", + directoryPath: "bitwise-functions/", + children: [ + "bitand", + "bitor", + "bitxor", + "bitnot" + ], + }, { title: "Hash函数", directoryPath: "hash-functions/", diff --git a/docs/en/sql-reference/sql-functions/bitwise-functions/bitand.md b/docs/en/sql-reference/sql-functions/bitwise-functions/bitand.md new file mode 100644 index 0000000000..07eae1e8f7 --- /dev/null +++ b/docs/en/sql-reference/sql-functions/bitwise-functions/bitand.md @@ -0,0 +1,57 @@ +--- +{ +"title": "bitand", +"language": "en" +} +--- + + + +# bitand +## description +### Syntax + +`BITAND(Integer-type lhs, Integer-type rhs)` + +Returns the result of the AND operation of two integers. + +Integer range: TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +## example + +``` +mysql> select bitand(3,5) ans; ++------+ +| ans | ++------+ +| 1 | ++------+ + +mysql> select bitand(4,7) ans; ++------+ +| ans | ++------+ +| 4 | ++------+ +``` + +## keyword + + BITAND diff --git a/docs/en/sql-reference/sql-functions/bitwise-functions/bitnot.md b/docs/en/sql-reference/sql-functions/bitwise-functions/bitnot.md new file mode 100644 index 0000000000..458011aa18 --- /dev/null +++ b/docs/en/sql-reference/sql-functions/bitwise-functions/bitnot.md @@ -0,0 +1,57 @@ +--- +{ +"title": "bitnot", +"language": "en" +} +--- + + + +# bitnot +## description +### Syntax + +`BITNOT(Integer-type value)` + +Returns the result of the NOT operation of one integer. + +Integer range: TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +## example + +``` +mysql> select bitnot(7) ans; ++------+ +| ans | ++------+ +| -8 | ++------+ + +mysql> select bitxor(-127) ans; ++------+ +| ans | ++------+ +| 126 | ++------+ +``` + +## keyword + + BITNOT diff --git a/docs/en/sql-reference/sql-functions/bitwise-functions/bitor.md b/docs/en/sql-reference/sql-functions/bitwise-functions/bitor.md new file mode 100644 index 0000000000..8c2d1c6383 --- /dev/null +++ b/docs/en/sql-reference/sql-functions/bitwise-functions/bitor.md @@ -0,0 +1,57 @@ +--- +{ +"title": "bitor", +"language": "en" +} +--- + + + +# bitor +## description +### Syntax + +`BITOR(Integer-type lhs, Integer-type rhs)` + +Returns the result of the OR operation of two integers. + +Integer range: TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +## example + +``` +mysql> select bitor(3,5) ans; ++------+ +| ans | ++------+ +| 7 | ++------+ + +mysql> select bitand(4,7) ans; ++------+ +| ans | ++------+ +| 7 | ++------+ +``` + +## keyword + + BITOR diff --git a/docs/en/sql-reference/sql-functions/bitwise-functions/bitxor.md b/docs/en/sql-reference/sql-functions/bitwise-functions/bitxor.md new file mode 100644 index 0000000000..849db173d6 --- /dev/null +++ b/docs/en/sql-reference/sql-functions/bitwise-functions/bitxor.md @@ -0,0 +1,57 @@ +--- +{ +"title": "bitxor", +"language": "en" +} +--- + + + +# bitxor +## description +### Syntax + +`BITXOR(Integer-type lhs, Integer-type rhs)` + +Returns the result of the XOR operation of two integers. + +Integer range: TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +## example + +``` +mysql> select bitxor(3,5) ans; ++------+ +| ans | ++------+ +| 7 | ++------+ + +mysql> select bitxor(1,7) ans; ++------+ +| ans | ++------+ +| 6 | ++------+ +``` + +## keyword + + BITXOR diff --git a/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitand.md b/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitand.md new file mode 100644 index 0000000000..c788381183 --- /dev/null +++ b/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitand.md @@ -0,0 +1,57 @@ +--- +{ +"title": "bitand", +"language": "zh-CN" +} +--- + + + +# bitand +## description +### Syntax + +`BITAND(Integer-type lhs, Integer-type rhs)` + +返回两个整数与运算的结果. + +整数范围:TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +## example + +``` +mysql> select bitand(3,5) ans; ++------+ +| ans | ++------+ +| 1 | ++------+ + +mysql> select bitand(4,7) ans; ++------+ +| ans | ++------+ +| 4 | ++------+ +``` + +## keyword + + BITAND diff --git a/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitnot.md b/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitnot.md new file mode 100644 index 0000000000..8ad7911898 --- /dev/null +++ b/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitnot.md @@ -0,0 +1,57 @@ +--- +{ +"title": "bitnot", +"language": "zh-CN" +} +--- + + + +# bitnot +## description +### Syntax + +`BITNOT(Integer-type value)` + +返回一个整数取反运算的结果. + +整数范围:TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +## example + +``` +mysql> select bitnot(7) ans; ++------+ +| ans | ++------+ +| -8 | ++------+ + +mysql> select bitxor(-127) ans; ++------+ +| ans | ++------+ +| 126 | ++------+ +``` + +## keyword + + BITNOT diff --git a/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitor.md b/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitor.md new file mode 100644 index 0000000000..c8fb159eb5 --- /dev/null +++ b/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitor.md @@ -0,0 +1,57 @@ +--- +{ +"title": "bitor", +"language": "zh-CN" +} +--- + + + +# bitor +## description +### Syntax + +`BITOR(Integer-type lhs, Integer-type rhs)` + +返回两个整数或运算的结果. + +整数范围:TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +## example + +``` +mysql> select bitor(3,5) ans; ++------+ +| ans | ++------+ +| 7 | ++------+ + +mysql> select bitand(4,7) ans; ++------+ +| ans | ++------+ +| 7 | ++------+ +``` + +## keyword + + BITOR diff --git a/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitxor.md b/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitxor.md new file mode 100644 index 0000000000..e3f4655eaa --- /dev/null +++ b/docs/zh-CN/sql-reference/sql-functions/bitwise-functions/bitxor.md @@ -0,0 +1,57 @@ +--- +{ +"title": "bitxor", +"language": "zh-CN" +} +--- + + + +# bitxor +## description +### Syntax + +`BITXOR(Integer-type lhs, Integer-type rhs)` + +返回两个整数异或运算的结果. + +整数范围:TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +## example + +``` +mysql> select bitxor(3,5) ans; ++------+ +| ans | ++------+ +| 7 | ++------+ + +mysql> select bitxor(1,7) ans; ++------+ +| ans | ++------+ +| 6 | ++------+ +``` + +## keyword + + BITXOR