Home  >  Article  >  Database  >  What are the commonly used functions in MySQL?

What are the commonly used functions in MySQL?

王林
王林forward
2023-05-26 14:23:011609browse

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;

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;
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());

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;

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');

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete