Home > Database > Mysql Tutorial > 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
Release: 2023-09-20 14:09:05
forward
713 people have browsed it

如果我们在 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)
Copy after login

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!

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