Home > Database > Mysql Tutorial > body text

What are the commonly used functions in MySQL?

王林
Release: 2023-05-26 14:23:01
forward
1614 people have browsed it

MySQL common functions

1. Numeric functions

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 )

2. String functions

What are the commonly used functions in MySQL?

The underline is commonly used (get the number of bytes)

What are the commonly used functions in MySQL?

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;
Copy after login

3. Time function

What are the commonly used functions in MySQL?

Usage: select now();

4. System function

What are the commonly used functions in MySQL?

In order to add separator:

select concat_ws('#',name,tel,height) from xxb;
Copy after login
select (substr(Now(),1,4)-substr(age,1,4) as 年龄 from zxc;
Copy after login

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);
Copy after login

Get the week:

select dayofweek(now()),dayname(now());
Copy after login

5. Aggregation function

Collect multiple data to calculate a single data value

What are the commonly used functions in MySQL?

Usage:

select sum(heigth) from c1;
Copy after login

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');
Copy after login

What are the commonly used functions in MySQL?

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template