Returns a string consisting of N  space characters. 

mysql> SELECT SPACE(6); -> ’ ’ 

• SUBSTR( str , pos ) , SUBSTR( str  FROM pos ) , SUBSTR( str , pos , len ) , SUBSTR( str  FROM pos FOR len ) 

SUBSTR()  is a synonym for SUBSTRING() . 

• SUBSTRING( str , pos ) , SUBSTRING( str  FROM pos ) , SUBSTRING( str , pos , len ) , SUBSTRING( str  FROM pos  FOR len ) 

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 . 

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’ 

This function is multibyte safe. 

If len  is less than 1, the result is the empty string. 

• SUBSTRING_INDEX( str , delim , count ) 

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 . 

mysql> SELECT SUBSTRING_INDEX(’www.mysql.com’, ’.’, 2); -> ’www.mysql’ mysql> SELECT SUBSTRING_INDEX(’www.mysql.com’, ’.’, -2); -> ’mysql.com’ 

This function is multibyte safe. 

• TO_BASE64( str ) 

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 

