"F"
HOUR(time)
Returns the hour given in time.
Example:
SELECT HOUR('11:45:01')
Results:
11
IF(expression1, expression2, expression3)
If expression1 evaluates to True, expression2 is returned. If expression1 is False, expression3
is returned.
Example:
SELECT IF(1, "This", "That")
SELECT IF(0, "This", "That")
Results:
"This"
"That"
IFNULL(expression1, expression2)
If expression1 is NULL, expression2 is returned. If expression1 is not NULL, expression1 is
returned.
Example:
SELECT IFNULL(Favorite_Movie, "None")
FROM Customers
WHERE Customer_ID = 5567
Results:
If the column Favorite_Movie is NULL then the word "None" is returned. If Favorite_Movie is not
NULL then the value for that column is returned. This is a handy function in case you must have
something returned in a resultset.
ISNULL(expression)
Returns 1 if the given expression is NULL. Returns 0 if it is not.
Example:
SELECT ISNULL(Favorite_Movie)
FROM Customers
WHERE Customer_ID = 2322
Results:
If the Favorite_Movie column is NULL then a 1 is returned. If not, a 0 is returned.
INSERT(x, y, z, j)
Returns the string x with j replacing the characters starting at y for a length of z.
Example:
SELECT INSERT("Database", 5, 4, "ware")
Result:
"Dataware"
INSTR(x, y)
Returns the value of the position of string y in string x. This is the reverse of LOCATE(x, y) and
POSITION(x, y).
Example:
SELECT INSTR("Mark", "M")
Result:
1