• notice
  • Congratulations on the launch of the Sought Tech site

Several useful functions in mysql

1.FROM_UNIXTIME
Function: Display the time stored in INT(11) in MYSQL in "YYYY-MM-DD" format.example:
select mtime, from_unixtime(mtime) from topics limit 10;




2.CONCAT(str1,str2,…) Function: 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 a fr parameter to all playlinks in the table
3.CONVERT(value, type); Function: Convert a value of one type to another type

The types that can be converted are limited.This type can be one of the following values:

-Binary, with the effect of the binary prefix: BINARY-Character, can take parameters: CHAR()-Date: DATE-Time: TIME-Date Time: DATETIME-Float: DECIMAL-Integer: SIGNED-Unsigned Integer: UNSIGNED Example: Suppose there is a money field, in order not to lose its decimal precision, we use varchar to record its value.But then there is a problem, what if you want to compare the size of such a field with a number?
select * from bill where convert(money, DECIMAL) > 100;

Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

order atorvastatin 40mg without preion & lt;a href="https://lipiws.top/"& gt;buy atorvastatin 40mg sale& lt;/a& gt; lipitor sale

Rwpmul

2024-03-10

Leave a Reply

+