Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commonly used built-in functions in mysql

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The main purpose of this article is to tell you briefly about the commonly used built-in functions in mysql. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on which commonly used built-in functions in mysql can bring you some practical help.

1. Aggregate function

COUNT () function: for any parameter except (*), returns the number of rows in the selected set that are not null, and for the parameter (*), returns the number of all rows in the set, including null worth the row. Count (*) without WHERE is internally optimized by mysql to return record parameters more quickly.

SUN () function: you can find the sum of the values of a field in a table.

AVG () function: find the average value of a field in the table

MAX () function: find the maximum value of a field in the table

MIN () function: finds the minimum value of a field in a table

2. Mathematical function

ABS () function: finds the absolute value of a field in a table

FLOOR () function: returns the largest integer less than or equal to the parameter x

RAND () function: returns a random number between 0 and 1

TRUNCATE (XBI y) function: returns the value of y digits after x is reserved to the decimal point

SQRT (x) function: find the square root of parameter x

3. String function

UPPER (s) and UCASE (s) functions: change all letters in the string s to uppercase letters

LEFT (sforce n) function: returns the first n characters of the string x

SUBSTRING function: get the string from the nth position of s

4. Date and time parameters

CURDATE () and CURRENT_DATE () functions: used to get the current date

CURTIME () and CURRENT_TIME () functions: used to get the current time

NOW () and CURRENT_TIMESTAMP () functions: get the current date and time

5. Other functions

The IF (expr,v1,v2) function: means that if the expression expr is true, v1 is executed, otherwise v2 is executed. (similar to trinomial budget)

IFNULL (expr,v2) function: returns the value of the expression if expr is not empty, otherwise v2

VERSION () function: gets the version number information of the system

Mysql which are commonly used built-in functions to tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report