Home > Database > Mysql Tutorial > body text

If I supply NULL to MySQL's ASCII() function, what does it return?

PHPz
Release: 2023-08-23 19:37:02
forward
969 people have browsed it

If I supply NULL to MySQLs ASCII() function, what does it return?

In this case, the output of the ASCII() function depends on whether we provide NULL as a string or just NULL. The following example will demonstrate the difference −

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)
Copy after login

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 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.

The above is the detailed content of If I supply NULL to MySQL's ASCII() function, what does it return?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template