LPAD() 函数用另一个字符串向左填充一个字符串,使其达到一定长度。
笔记:另请参阅RPAD()功能。
LPAD(
string,
length,
lpad_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 left-padded |
lpad_string | Required. The string to left-pad to string |
工作于: | 从 MySQL 4.0 开始 |
---|
用"ABC" 向左填充 "CustomerName" 中的文本,使总长度为 30:
SELECT LPAD(CustomerName, 30, "ABC") AS LeftPadCustomerName
FROM Customers;
亲自试一试 »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!