RPAD() 函数用另一个字符串右填充一个字符串至一定长度。
笔记:另请参阅LPAD()功能。
RPAD(
string,
length,
rpad_string)
Parameter | Description |
---|---|
string | Required. The original string. If the length of the original string is larger than the length parameter, this function removes the overfloating characters from string |
length | Required. The length of the string after it has been right-padded |
rpad_string | Required. The string to right-pad to string |
工作于: | 从 MySQL 4.0 开始 |
---|
将 "CustomerName" 中的文本用 "ABC" 向右填充,使总长度为 30:
SELECT RPAD(CustomerName, 30, "ABC") AS RightPadCustomerName
FROM Customers;
亲自试一试 »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!