Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
Result:

"ark"
Example:
SELECT TRIM(BOTH "X" FROM "XXXFILE.XXX")
Result:

"FILE."

TRUNCATE(x,y)


Returns the argument x truncated to y decimal places. If y is 0, no decimal places will be returned in the
result.
Example:
TRUNCATE(3.4567, 2)
Result:


3.45
Example:
TRUNCATE(3.4567, 0)
Result:

3

UCASE(x)


Returns the string x with all characters in uppercase. See UPPER(), LOWER(), and LCASE().
Example:
SELECT UCASE('sam I am')
Result:


"SAM I AM"

UNIX_TIMESTAMP([date])


Without the optional date argument, returns a UNIX timestamp. If a date is given, it will return the date as a
UNIX timestamp.
Example:
SELECT UNIX_TIMESTAMP()
Result:


949301344
Example:
SELECT UNIXTIMESTAMP('2000-02-27')
Result:

951631200

UPPER(x)


Returns the string x with all characters in uppercase. See UCASE(), LOWER(), and LCASE().
Example:
SELECT UPPER('sam I am')
Result:


"SAM I AM"

USER()


Returns the name of the user for the current connection.
Example:
SELECT USER()
Result:


'mark@localhost'
Free download pdf