首页 > 代码库 > MID(s,n,len)

MID(s,n,len)

MID(s,n,len) 用于获取指定位置的子字符串

mysql> SELECT MID(breakfast,5) AS col1,  # 从第5个字符串开始获取    -> MID(breakfast,5,3) AS col2,       # 从第5个字符串开始,获取3个    -> MID(breakfast,-5) AS col3,        # (倒向)从第5个字符串开始获取    -> MID(breakfast,-5,3) AS col4;      # (倒向)从第5个字符串开始获取,获取3个+-------+------+-------+------+| col1  | col2 | col3  | col4 |+-------+------+-------+------+| kfast | kfa  | kfast | kfa  |+-------+------+-------+------+

 

 

 

 

    

MID(s,n,len)