Synonym for SUBSTRING(). Returns a substring starting at a specified position for a given length.
MID(str,pos,len)MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len)!
A negative starting position:
This page is licensed: GPLv2, originally from
SELECT MID('abcd',4,1);
+-----------------+
| MID('abcd',4,1) |
+-----------------+
| d |
+-----------------+
SELECT MID('abcd',2,2);
+-----------------+
| MID('abcd',2,2) |
+-----------------+
| bc |
+-----------------+SELECT MID('abcd',-2,4);
+------------------+
| MID('abcd',-2,4) |
+------------------+
| cd |
+------------------+