1.MySQL functions 1. Mathematical functions PI() #Returns the value of pi (pi). The default number of decimal places is 6. FLOOR(x) returns the largest integer less than x (rounding off decimals) CEILING(x) rounds up ROUND (x, y) rounds the value of the operation to y decimal places. If y is a negative number, it rounds to y decimal places. RAND(x) returns a random number. If x is the same, the random number returned is the same. TURNCATE(x,y) returns x with y decimal places ABS(X) Returns the absolute value of x MOD(X, Y) returns the remainder after dividing X by Y, even for decimals. SQRT(x) Returns the square root of a non-negative number x. SIGN(X) returns the sign of the parameter. If the value of x is positive, 0, or negative, it returns 1, 0, or -1 respectively. POW(X,Y), POWER(X,Y), EXP(X) Power functions LOG(X), LOG10(X) Logarithmic operation RADIANS(X), DEGREES(X) functions for converting between degrees and radians SIN(X), ASIN(X) sine function, inverse sine function COS(X), ACOS(X) cosine and arccosine functions 2. Aggregate Functions AVG(x) #average COUNT(col) #Returns the number of non-controlled values in a column MIN(col) #Returns the minimum value of a column MAX(col) #Returns the maximum value of a column SUM(col) #Returns the sum of a column 3. String functions CONCAT(s1,s2,s3,...)#connect strings s1,s2,s3,... LTRIM(str) #Remove the space at the beginning of str RTRIM(str)#Remove the space at the end of str TRIM(str)#Remove spaces at both ends of STR substring(str, start interception position loc, interception length len) #loc=1: first position, 2 second position 4. Date functions YEAR(date) #Returns the year of date (1000-9999) MONTH(data)#Returns the month of date (1-12) DAY(data)#Return date (1-31) HOUR(time) MINUTE(time) SECOND(time) DATE(datetime) TIME(datetime) 5. Grouping Function as is a keyword for taking an alias, which can be omitted select mathematical function (field name) alias, field name from indicates group by field name #If you want to find the average score of each class #If you use a grouping function, the fields that are not in the group must be placed after group by The above is a detailed explanation and integration of MySQL database functions introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: How to build mysql master-slave server on centos7 (graphic tutorial)
>>: jQuery achieves large-screen scrolling playback effect
All tags must be lowercase In XHTML, all tags must...
As a front-end monkey, whether it is during an in...
Table of contents Achieve results Complete code +...
1. Basic Specifications (1) InnoDB storage engine...
In my last post I talked about how to make a web p...
Table of contents Download tf-gpu Build your own ...
background When I was using Docker these two days...
1. Let's look at a table creation statement f...
Preface In front-end programming, we often use th...
When doing DB benchmark testing, qps and tps are ...
Today I will share with you a source code contain...
Root directory and index file The root directive ...
Installation suggestion : Try not to use .exe for...
Table of contents Introduction to frm files and i...
<br />Previous tutorial: Web Design Tutorial...