Home >Database >Mysql Tutorial >What are the commonly used functions in MySQL?
Additional: ceil(x) If ceil(1.23) has a value of 2, it can be written as ceiling(x )
The underline is commonly used (get the number of bytes)
Additional: char_length characters (query the last three digits of the name) For example: char_length(name)=3 can be written as:
select left(name,1) from c1;
Usage: select now();
In order to add separator:
select concat_ws('#',name,tel,height) from xxb;
select (substr(Now(),1,4)-substr(age,1,4) as 年龄 from zxc;
Downline SQL statement description: The first now() is used for comparison, interval 50 minute means pushing back 50 units, - 50 means pushing forward 50 units year(now()) to get the year; month (now()) takes the month; day(now()) takes the day; nour(now()) takes the time; minute(now()) takes the minute; second(now()) takes the second
select now(),date_add(now(),interval 50 minute);
Get the week:
select dayofweek(now()),dayname(now());
Collect multiple data to calculate a single data value
Usage:
select sum(heigth) from c1;
Get the number of records (number of rows) and filter out null values: count() If one row in row 14 is empty, then count() is row 13. Count() can be added with count(*), which is more accurate. Count(*) is generally used to count
to calculate the number of units of difference between two dates, such as: select timestampdiff (time unit, date time 1, date time 2) written as:
select timestampdiff(day,'2021-11-18','2021-11-22');
Thank you to everyone who reads my article carefully! ! ! If the following information is available, you can take it away directly:
1. Complete project source code and environment necessary for self-study development or testing
2. All templates in testing work (test plan, test Use cases, test reports, etc.)
3. Classic software testing interview questions
4. Python/Java automated testing practice.pdf
5. Jmeter/postman interface test full set of videos Obtain
The above is the detailed content of What are the commonly used functions in MySQL?. For more information, please follow other related articles on the PHP Chinese website!