哪個 MySQL 函式可用於找出字串的位長度?


MySQL BIT_LENGTH() string 函式用於獲取字串的位長度。

語法

BIT_LENGTH(Str)

此處,BIT_LENGTH() 函式的引數 Str 是要檢索其 BIT_LENGTH 值的字串。Str 可以是字串或數字字串。如果它是字串,則必須用引號引起來。

示例

mysql> Select BIT_LENGTH('New Delhi');

+-------------------------+
| BIT_LENGTH('New Delhi') |
+-------------------------+
| 72                      |
+-------------------------+

1 row in set (0.00 sec)

mysql> select BIT_LENGTH(123456);

+--------------------+
| BIT_LENGTH(123456) |
+--------------------+
| 48                 |
+--------------------+

1 row in set (0.00 sec)

更新於: 20-Jun-2020

79 次閱讀

開啟你的 職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.