String Functions and Operators Returns a string consisting of  N  space characters. SUBSTR()  is a synonym for  SUBSTRING() . The forms without a  len  argument return a substring from string  str  starting at position  pos . The forms with a  len  argument return a substring  len  characters long from string  str , starting at position  pos . The forms that use  FROM  are standard SQL syntax. It is also possible to use a negative value for  pos . In this case, the beginning of the substring is  pos  characters from the end of the string, rather than the beginning. A negative value may be used for  pos  in any of the forms of this function. A value of 0 for pos  returns an empty string. For all forms of  SUBSTRING() , the position of the first character in the string from which the substring is to be extracted is reckoned as  1 . This function is multibyte safe. If  len  is less than 1, the result is the empty string. Returns the substring from string  str  before  count  occurrences of the delimiter  delim . If  count is positive, everything to the left of the final delimiter (counting from the left) is returned. If  count is negative, everything to the right of the final delimiter (counting from the right) is returned. SUBSTRING_INDEX()  performs a case-sensitive match when searching for  delim . This function is multibyte safe. Converts the string argument to base-64 encoded form and returns the result as a character string with the connection character set and collation. If the argument is not a string, it is converted to a string 2182 • TO_BASE64( str ) • SUBSTRING_INDEX( str , delim , count ) mysql>  SELECT SUBSTRING_INDEX(’www.mysql.com’, ’.’, 2); -> ’www.mysql’ mysql>  SELECT SUBSTRING_INDEX(’www.mysql.com’, ’.’, -2); -> ’mysql.com’ mysql>  SELECT SUBSTRING(’Quadratically’,5); -> ’ratically’ mysql>  SELECT SUBSTRING(’foobarbar’ FROM 4); -> ’barbar’ mysql>  SELECT SUBSTRING(’Quadratically’,5,6); -> ’ratica’ mysql>  SELECT SUBSTRING(’Sakila’, -3); -> ’ila’ mysql>  SELECT SUBSTRING(’Sakila’, -5, 3); -> ’aki’ mysql>  SELECT SUBSTRING(’Sakila’ FROM -4 FOR 2); -> ’ki’ mysql>  SELECT SPACE(6); -> ’ ’ • SUBSTR( str , pos ) ,  SUBSTR( str  FROM  pos ) ,  SUBSTR( str , pos , len ) ,  SUBSTR( str  FROM  pos FOR  len ) • SUBSTRING( str , pos ) ,  SUBSTRING( str  FROM  pos ) ,  SUBSTRING( str , pos , len ) , SUBSTRING( str  FROM  pos  FOR  len )