当前位置:网站首页>MySQL advanced common functions
MySQL advanced common functions
2022-04-23 20:45:00 【Jan York】
occasionally , In addition to simple data query , We also have some advanced functions .
MySQL
Contains a large number and rich functions , This set of MySQL
The complete collection of functions only collects dozens of commonly used , The rest of the relatively rare functions will not be sorted out , Readers can go to MySQL Official website Inquire about .
source :C Chinese language network
MySQL
Functions of numerical type
The name of the function | do use |
---|---|
ABS |
Find the absolute value |
SQRT |
Find the quadratic root |
MOD |
Mod |
CEIL and CEILING |
The two functions have the same function , All return the minimum integer no less than the parameter , That is, round up |
FLOOR |
Rounding down , The return value is converted to a BIGINT |
RAND |
Generate a 0~1 Random number between , The input integer parameter is , Used to generate repeat sequences |
ROUND |
Round the parameters passed |
SIGN |
Returns the symbol of the parameter |
POW and POWER |
The functions of the two functions are the same , Are the result values of the power of the passed parameters |
kSIN |
Find the sine |
ASIN |
Find the inverse sine , And functions SIN They're inverse functions to each other |
COS |
Find the cosine |
ACOS |
Find the inverse cosine , And functions COS They're inverse functions to each other |
TAN |
Find tangent |
ATAN |
Find the arctangent , And functions TAN They're inverse functions to each other |
COT |
Find the cotangent value |
MySQL
String function
The name of the function | do use |
---|---|
LENGTH |
Evaluate string length function , Returns the byte length of the string |
CONCAT |
Merge string functions , The return result is the string generated by the connection parameter , Parameters can make one or more |
INSERT |
Replace string functions |
LOWER |
Convert the letters in the string to lowercase |
UPPER |
Convert the letters in the string to uppercase |
LEFT |
Take the string from the left side of the word , Returns several characters to the left of the string |
RIGHT |
Take the string from the right word , Returns several characters to the right of the string |
TRIM |
Delete the spaces on the left and right of the string |
REPLACE |
String replacement function , Return the new string after replacement |
SUBSTRING |
Intercepting string , Returns a character change of a specified length starting at a specified location |
REVERSE |
String inversion ( The reverse ) function , Returns the string in reverse order to the original string |
MySQL
Date and time functions
The name of the function | do use |
---|---|
CURDATE and CURRENT_DATE |
The two functions work the same , Returns the date value of the current system |
CURTIME and CURRENT_TIME |
The two functions work the same , Returns the time value of the current system |
NOW and SYSDATE |
The two functions work the same , Returns the date and time values of the current system |
UNIX_TIMESTAMP |
obtain UNIX Time stamp function , Return one to UNIX A timestamp based unsigned integer |
FROM_UNIXTIME |
take UNIX Time stamp converted to time format , And UNIX_TIMESTAMP They're inverse functions to each other |
MONTH |
Get the month in the specified date |
MONTHNAME |
Get the English name of the month in the specified date |
DAYNAME |
Get the English name of the day of the week corresponding to the specified date |
DAYOFWEEK |
Gets the index location value of the week corresponding to the specified date |
WEEK |
Get the specified date is the week of the year , Whether the return value range is 0〜52 or 1〜53 |
DAYOFYEAR |
The date of acquisition is the day of the year , The return value range is 1~366 |
DAYOFMONTH |
Get the specified date is the day of the month , The return value range is 1~31 |
YEAR |
Get year , The return value range is 1970〜2069 |
TIME_TO_SEC |
Convert the time parameter to seconds |
SEC_TO_TIME |
Convert seconds to time , And TIME_TO_SEC They're inverse functions to each other |
DATE_ADD and ADDDATE |
The two functions have the same function , All add the specified time interval to the date |
DATE_SUB and SUBDATE |
The two functions have the same function , It's all subtracting the specified time interval from the date |
ADDTIME |
Time addition operation , Add the specified time... To the original time |
SUBTIME |
Time subtraction , Subtract the specified time from the original time |
DATEDIFF |
Get the interval between two dates , Returns the parameter 1 Subtract the parameter 2 Value |
DATE_FORMAT |
Format the specified date , Returns the value of the specified format according to the parameter |
WEEKDAY |
Get the corresponding working day index of the specified date in a week |
MySQL
Aggregate functions
The name of the function | effect |
---|---|
MAX |
Query the maximum value of the specified column |
MIN |
Query the minimum value of the specified column |
COUNT |
Count the number of rows in the query result |
SUM |
Sum up , Returns the sum of the specified columns |
AVG |
averaging , Returns the average of the specified column data |
MySQL
Process control functions
The name of the function | effect |
---|---|
IF |
Judge , Process control |
IFNULL |
Determine whether it is null |
CASE |
Search statement |
版权声明
本文为[Jan York]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204232039375673.html
边栏推荐
- 又一款数据分析神器:Polars 真的很强大
- go defer
- Learn to C language fourth day
- 2022dasctf APR x fat epidemic prevention challenge crypto easy_ real
- CONDA environment management command
- Recommended usage scenarios and production tools for common 60 types of charts
- 【SQL】字符串系列2:将一个字符串根据特定字符分拆成多行
- LeetCode 1351、统计有序矩阵中的负数
- Vulnhub DC: 1 penetration notes
- Leetcode 994, rotten orange
猜你喜欢
Leetcode 994, rotten orange
居家第二十三天的午饭
Unity animation creates sequence frame code and generates animationclip
MySQL进阶之数据的增删改查(DML)
[stack and queue topics] - sliding window
Vulnhub DC: 1 penetration notes
Resolve the error - error identifier 'attr_ id‘ is not in camel case camelcase
go slice
100天拿下11K,转岗测试的超全学习指南
Preliminary understanding of cache elimination algorithm (LRU and LFU)
随机推荐
Leetcode 232, queue with stack
Fastdfs思维导图
On IRP from the perspective of source code
Vulnhub DC: 1 penetration notes
C migration project record: modify namespace and folder name
Solution: NPM err! code ELIFECYCLE npm ERR! errno 1
2021-09-02 unity project uses rider to build hot change project failure record of ilruntime
I JS deep copy and shallow copy
MySQL基础之写表(创建表)
pikachuxss如何获取cookie靶场,返回首页总是失败
上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
go interface
"Meta function" of tidb 6.0: what is placement rules in SQL?
Cmake project under vs2019: calculating binocular parallax using elas method
内网渗透之DOS命令
Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
常用60类图表使用场景、制作工具推荐
Send email to laravel
Identifier CV is not defined in opencv4_ CAP_ PROP_ FPS; CV_ CAP_ PROP_ FRAME_ COUNT; CV_ CAP_ PROP_ POS_ Frames problem
GSI-ECM工程建设管理数字化平台