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

(singke) #1
Result:

"Mark"

MAX(expression)


Returns the maximum value of the given expression.
Example:
SELECT MAX(Customer_ID) FROM Customers
Results:


387

MID(x, y, z)


Returns a string z characters long from string x, starting at position y.
Example:
SELECT MID("Database", 4, 4)
Result:


"base"

MIN(expression)


Returns the smallest value (minimum) of the given expression.
Example:
SELECT MIN(Customer_ID) FROM Customers
Results:


1

MINUTE (time)


Returns the minute given in time.
Example:
SELECT MINUTE('11:45:01')
Results:


45

MOD(x,y)


Returns the remainder of x divided by y. The symbol % can also be used.
Example:
SELECT MOD(13,2)
Result:


1
Example:
SELECT 19 % 7
Result:

5

MONTH(date)


Returns the index for the month given in date.
Example:
SELECT MONTH('2000-01-27')
Result:


1

MONTHNAME(date)


Returns the name of the month given in date.
Example:
SELECT MONTHNAME("2000-05-10")
Result:

Free download pdf