LAST_INSERT_ID()
Returns the last sequence number of an inserted record in an AUTO_INCREMENT column. This number is
stored based on the connection. So, if two records were inserted into the same table from two different
connections, the last number for the first connection would be the record it inserted, and the number for the
second connection would be the number that it inserted.
Example:
SELECT LAST_INSERT_ID()
Result:
15
LCASE(x)
Returns the string x with all characters in lowercase. See LOWER(), UCASE(), UPPER().
Example:
SELECT LCASE('MARK')
Result:
"mark"
LEAST(x, y, z,...)
Returns the smallest valued argument. The following rules are used for comparisons:
If all values are integers, they are compared as integers.
If the argument is a case-sensitive string, they are compared as case-sensitive
strings. Otherwise, they are compared as non–case-sensitive strings.
See GREATEST().
Example:
SELECT LEAST(9, 45, 12, 34, 6)
Result:
6
Example:
SELECT LEAST("A", "B", "C")
Result:
A
Example:
SELECT LEAST("Mark", "Sam", "Ken")
Result:
Ken
LEFT(x,y)
Returns the number of characters from x, starting from the left until it reaches a length of y. See RIGHT().
Example:
SELECT LEFT("Database", 4)
Result:
"Data"
LENGTH(x)
Returns the length of string x.
Example:
SELECT LENGTH("The Quick Brown Fox")
Result:
19
LOAD_FILE(filename)
Opens the file and returns the contents as a string. The file must reside on the server, and the user of this
function must have FILE privileges.
Example:
UPDATE Products SET Picture = LOAD_FILE("/home/pictures/Flowers.gif") WHERE Product_ID = 12