Several useful functions in mysql, useful functions in mysql
1. FROM_UNIXTIME
Purpose: display the time stored in INT (11) in MYSQL in the "YYYY-MM-DD" format. Example:
select mtime, from_unixtime(mtime) from topics limit 10;
2.
CONCAT (str1, str2 ,...)Purpose: concatenate str1, str2. .. into a string. If any parameter is NULL, the return value is NULL. Example:
update video set playlink = concat(playlink, '&fr=abcd');
Add the fr parameter to all playlinks in the table.
3. CONVERT (value, type );Function: converts a value of one type to another.
There are limits on the types that can be converted. This type can be one of the following values:
-Binary, with the same effect as BINARY Prefix: binary-numeric type, with parameters: CHAR ()-DATE: DATE-TIME: TIME-DATE: DATETIME-Floating Point Number: DECIMAL-integer: SIGNED-UNSIGNED integer: UNSIGNED example: assume there is a money field. To avoid losing the DECIMAL precision, we use varchar to record its value. However, what if we want to compare the size of this field with the number?
select * from bill where convert(money, DECIMAL) > 100;