In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "built-in function usage in MySQL". The explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the built-in function usage in MySQL.
Update delete is used in select statements and in the clause where order by hacing
You can use the field name as a field in the function, and the value of the variable is each row of records corresponding to this column.
I. string function
Most of the functions used in mysql are also provided
Www.2cto.com
1. CONCAT ("string", field, …... .): concatenate the passed parameters into a string, return the concatenated string concat ('adf','bb') and return adfbb
2. INSER (str,x,y,insert): replace the string length y at the beginning of the string str,x position with the string insert
LOWER (str) UPPER (str): converts a string to uppercase or lowercase.
4. LEFT (str,x) RIGHT (str,x): returns the leftmost x characters and the rightmost x characters respectively, and returns null if the second parameter is null
5. LPAD (str,n,pad) RPAD (str,n,pad): populate the leftmost and rightmost str with the string pad until the length is n characters
6. TRIM (str) LTRIM (str) RTRIM (str) / / remove the spaces on both sides of the string, left, and right
7. Replace (str,a,b): replace all occurrence of string an in str with the string b
8. Strcmp (S1 ~ S2): compare ASC size, return-1 if S1 is smaller than S2, return 1 if S1 is larger than S2, and return 0 if S1 equals S2
9. Substring (str,x,y): returns a string of y length from the x-th position in the string str.
Second, numerical function
Www.2cto.com
ABS (x): returns the absolute value of x
Ceil (x): returns the smallest integer 2.1 2.5 2.9 greater than x and returns the 3-in-1 middle method.
Floor (x); returns the maximum integer less than x 2.1 2.5 2.9 returns 2 rounding
Mod (xPowery): returns the module of xgamy
Rand (): random number between 0-1
Round (xQuery y): returns the value of the parameter x rounded with y decimal places
Truncate (xmemy): returns the result of the number x truncated to y decimal places truncate (1.239Power2) returns 1.23
III. Date function
When using the timestamp of php to complete
Curdate (): returns the date
Now (): returns the date and time
Curtime (): return time
Unix_timestamp (now ()); returns the unix timestamp
From_unixtime (1231314); returns the time of the timestamp
Www.2cto.com
Week (now ())
Year (now ())
Hour (curtime ())
Minute (curtime ())
Monthname (now ()); month name
Date_format (now (), "% Y-%m-%d% HRV% iRU%")
Fourth, process control function
If (value, tjingf); select if (field > 300) from; return v1 if the condition is true, otherwise return v2
Ifnull (value1,value2) returns value1 if value1 is not empty, value if empty
Case when [value1] then [result]. .. else[default] end
Case when then else end / / select case when salary
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.