In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what are the digital functions in MySQL, which can be used for reference by interested friends. I hope you can learn a lot after reading this article.
Numeric function
1. ABS (x) returns the absolute value of x
SELECT ABS (- 1);-returns 1
2. AVG (expression) returns the average of an expression, and expression is a field.
SELECT AVG (age) FROM student
3. CEIL (x) / CEILING (x) returns the smallest integer greater than or equal to x
SELECT CEIL (1.5); SELECT CEILING (1.5);-return 2
4. FLOOR (x) returns the largest integer less than or equal to x
SELECT FLOOR (1.5);-return 1
5. EXP (x) returns to the x power of e
SELECT EXP (3);-calculates the third power of e and returns 20.085536923188
6. GREATEST (expr1, expr2, expr3, …) Returns the maximum value in the list
SELECT GREATEST (3, 12, 34, 8, 25);-returns the maximum value 34 in the following list of numbers
7. LEAST (expr1, expr2, expr3, …) Returns the minimum value in the list
SELECT LEAST (3, 12, 34, 8, 25);-returns the minimum value of 3 in the following list of numbers
8. LN returns the natural logarithm of a number
SELECT LN (2);-returns the natural logarithm of 2: 0.6931471805599453
9. LOG (x) returns the natural logarithm (the logarithm based on e)
SELECT LOG (20.085536923188);-returns 3
10. MAX (expression) returns the maximum value in the field expression
SELECT MAX (age) AS maxAge FROM Student;---- age maximum
11. MIN (expression) returns the maximum value in the field expression
SELECT MIN (age) AS minAge FROM Student;---- age minimum
12. POW (x ~ () y) / POWER (x ~ ()) returns x to the y power.
SELECT POW (2, 3); SELECT POWER (2, 3);-returns 2 to the third: 8
13. RAND () returns a random number from 0 to 1
SELECT RAND ();-returns a random number from 0 to 1. If there is a number in (), if RAND (x), x is the same, the return value is the same.
14. ROUND (x) returns the integer closest to x
SELECT ROUND (1.23456);-returns 1
15. SIGN (x) returns the symbol of x, where x is negative, 0, and positive returns-1, 0, and 1, respectively.
SELECT SIGN (- 10);-return-1
16. SQRT (x) returns the square root of x
SELECT SQRT (25);-returns 5
17. SUM (expression) returns the sum of the specified fields
SELECT SUM (age) AS totalAage FROM Student;---- returns the sum of age
18. TRUNCATE (xQuery y) returns the value x reserved to the decimal point (the biggest difference from ROUND is that it is not rounded)
SELECT TRUNCATE (1.23456);-return 1.234 Thank you for reading this article carefully. I hope the article "what are the digital functions in MySQL" shared by the editor will be helpful to you? at the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.