Name

MID()

Synopsis

MID(str, pos, len)

Returns up to len characters from the string str starting at position pos. If len is omitted, then all characters up to the end of the string are returned. You may use a negative value for pos, in which case it represents the character pos places from the end of the string. The first position in the string is 1. This code returns the string “stop”:

SELECT MID('Christopher Columbus', '6', '4');

Get Learning PHP, MySQL, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.