MID() 函数从字符串中提取子字符串(从任意位置开始)。
MID(
string,
start,
length)
Parameter | Description |
---|---|
string | Required. The string to extract from |
start | Required. The start position. Can be both a positive or negative number. If it is a positive number, this function extracts from the beginning of the string. If it is a negative number, this function extracts from the end of the string |
length | Required. The number of characters to extract |
工作于: | 从 MySQL 4.0 开始 |
---|
从列中的文本中提取子字符串(从位置 2 开始,提取 5 个字符):
SELECT MID(CustomerName, 2, 5) AS ExtractString
FROM Customers;
亲自试一试 »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!