Home  >  Article  >  Database  >  What will MySQL return if we provide an empty string to fill in other strings in the LPAD() or RPAD() function?

What will MySQL return if we provide an empty string to fill in other strings in the LPAD() or RPAD() function?

PHPz
PHPzforward
2023-09-20 14:09:05682browse

如果我们在 LPAD() 或 RPAD() 函数中提供一个空字符串来填充其他字符串,MySQL 将返回什么?

Suppose if we provide an empty string for padding on LPAD() or RPAD() function, then MySQL will return NULL as output. The following example will demonstrate it -

Example

mysql> Select LPAD('ABCD',22,'');

+--------------------+
| LPAD('ABCD',22,'') |
+--------------------+
| NULL               |
+--------------------+

1 row in set (0.00 sec)

mysql> Select RPAD('ABCD',22,'');

+--------------------+
| RPAD('ABCD',22,'') |
+--------------------+
| NULL               |
+--------------------+

1 row in set (0.00 sec)

The above is the detailed content of What will MySQL return if we provide an empty string to fill in other strings in the LPAD() or RPAD() function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete