首頁  >  文章  >  資料庫  >  如果我將NULL提供給MySQL的ASCII()函數,它會回傳什麼?

如果我將NULL提供給MySQL的ASCII()函數,它會回傳什麼?

PHPz
PHPz轉載
2023-08-23 19:37:02969瀏覽

如果我將NULL提供給MySQL的ASCII()函數,它會回傳什麼?

在這種情況下,ASCII()函數的輸出取決於我們是否將NULL作為字串提供,還是只提供NULL。以下範例將示範區別−

mysql> SELECT ASCII(null);
+-------------+
| ASCII(null) |
+-------------+
| NULL        |
+-------------+
1 row in set (0.00 sec)

mysql> SELECT ASCII('null');
+---------------+
| ASCII('null') |
+---------------+
| 110           |
+---------------+
1 row in set (0.00 sec)

mysql> Select ASCII(NULL);
+-------------+
| ASCII(NULL) |
+-------------+
| NULL        |
+-------------+
1 row in set (0.00 sec)

mysql> Select ASCII('NULL');
+---------------+
| ASCII('NULL') |
+---------------+
| 78            |
+---------------+
1 row in set (0.00 sec)

As we can observe from the above result set that when we will provide NULL or null as a string, ASCII() function will return the number code of the first character i.e. number code of the first character i.e. number code of of N in case of 'NULL' and number code of n in case of 'null', otherwise when we provide simply NULL then it returns NULL as output.

以上是如果我將NULL提供給MySQL的ASCII()函數,它會回傳什麼?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除