
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What will MySQL CHAR_LENGTH() function return if I provide NULL to it?
In this case, the output of CHAR_LENGTH() function depends on the condition that whether we are providing NULL as a string or we are providing simply NULL to it. Following example will demonstrate the difference −
mysql> Select CHAR_LENGTH(NULL); +-------------------+ | CHAR_LENGTH(NULL) | +-------------------+ | NULL | +-------------------+ 1 row in set (0.00 sec) mysql> Select CHAR_LENGTH('NULL'); +---------------------+ | CHAR_LENGTH('NULL') | +---------------------+ | 4 | +---------------------+ 1 row in set (0.00 sec)
As we can observe from the above result set that when we will provide NULL as a string, CHAR_LENGTH() function will return the number of characters i.e. 4, otherwise when we provide simply NULL then it returns NULL as output.
- Related Questions & Answers
- What MySQL ASCII() function returns if I will provide NULL to it?
- What MySQL CHAR_LENGTH() function returns if no parameter is provided to it?
- What happens if we provide NULL as an argument to MySQL CHAR() function?
- What MySQL returns if I provide a non-hexadecimal number as an argument to UNHEX() function?
- What MySQL COALESCE() function returns if all the arguments provided to it are NULL?
- What happens if I will use integer values as arguments of MySQL LOCATE() function?
- What is the purpose of using MySQL CHAR_LENGTH() function? Which function is the synonym of it?
- How MySQL evaluates if I will use an expression within SUM() function?
- What MySQL returns if we provide value larger than 255 as argument to MySQL CHAR() function?
- What is the difference between MySQL LENGTH() and CHAR_LENGTH() function?
- How can I return 0 for NULL in MySQL?
- What happens if I will delete a row from MySQL parent table?
- Sum if all rows are not null else return null in MySQL?
- What MySQL COALESCE() function returns if it has a blank, but not NULL, as the first argument?
- What MySQL returns if the argument of QUOTE() function is NULL?
Advertisements