当前位置:网站首页>MySql函数
MySql函数
2022-07-24 15:08:00 【ahyo】
– ================ 内置函数 ================
– 数值函数
abs(x) – 绝对值 abs(-10.9) = 10
format(x, d) – 格式化千分位数值 format(1234567.456, 2) = 1,234,567.46
ceil(x) – 向上取整 ceil(10.1) = 11
floor(x) – 向下取整 floor (10.1) = 10
round(x) – 四舍五入去整
mod(m, n) – m%n m mod n 求余 10%3=1
pi() – 获得圆周率
pow(m, n) – m^n
sqrt(x) – 算术平方根
rand() – 随机数
truncate(x, d) – 截取d位小数
– 时间日期函数
now(), current_timestamp(); – 当前日期时间
current_date(); – 当前日期
current_time(); – 当前时间
date(‘yyyy-mm-dd hh:ii:ss’); – 获取日期部分
time(‘yyyy-mm-dd hh:ii:ss’); – 获取时间部分
date_format(‘yyyy-mm-dd hh:ii:ss’, ‘%d %y %a %d %m %b %j’); – 格式化时间
unix_timestamp(); – 获得unix时间戳
from_unixtime(); – 从时间戳获得时间
– 字符串函数
length(string) – string长度,字节
char_length(string) – string的字符个数
substring(str, position [,length]) – 从str的position开始,取length个字符
replace(str ,search_str ,replace_str) – 在str中用replace_str替换search_str
instr(string ,substring) – 返回substring首次在string中出现的位置
concat(string [,…]) – 连接字串
charset(str) – 返回字串字符集
lcase(string) – 转换成小写
left(string, length) – 从string2中的左边起取length个字符
load_file(file_name) – 从文件读取内容
locate(substring, string [,start_position]) – 同instr,但可指定开始位置
lpad(string, length, pad) – 重复用pad加在string开头,直到字串长度为length
ltrim(string) – 去除前端空格
repeat(string, count) – 重复count次
rpad(string, length, pad) --在str后用pad补充,直到长度为length
rtrim(string) – 去除后端空格
strcmp(string1 ,string2) – 逐字符比较两字串大小
– 聚合函数
count()
sum();
max();
min();
avg();
group_concat()
– 其他常用函数
md5();
default();
边栏推荐
- Various searches (⊙▽⊙) consolidate the chapter of promotion
- VSCode如何调试Nodejs
- Activate the newly installed Anaconda in the server
- The spiral matrix of the force buckle rotates together (you can understand it)
- Performance test - Test Execution
- Number of bytes occupied by variables of type char short int in memory
- File upload and download and conversion between excel and data sheet data
- Can you buy 6% of financial products after opening a stock account?
- spark:指定日期输出相应日期的日志(入门级-简单实现)
- Performance test - analyze requirements
猜你喜欢

27.目录与文件系统

(09) flask is OK if it has hands - cookies and sessions

LeetCode高频题56. 合并区间,将重叠的区间合并为一个区间,包含所有区间

MongoDB入门学习

onBlur和onChange冲突解决方法

Unity uses NVIDIA flex for unity plug-in to realize the effects of making software, water, fluid, cloth, etc. learning tutorial

Kotlin class and inheritance

The sliding window of Li Kou "step by step" (209. The smallest sub array, 904. Fruit baskets)

AG. DS binary tree -- hierarchical traversal

Jmmert aggregation test report
随机推荐
Operation of MySQL Library
Rasa 3.x learning series -rasa [3.2.4] - 2022-07-21 new release
CSDN garbage has no bottom line!
Attributeerror: module 'distutils' has no attribute' version error resolution
Summary of feature selection: filtered, wrapped, embedded
Tiger mouth waterfall: Tongliang version of xiaohukou waterfall
Simple encapsulation of wechat applet wx.request
Tensorflow framework of deep learning realizes vgg/rnn network / verification code generation and recognition / text classification
DS graph - minimum spanning tree
Performance test - Preparation of test plan
The vs compiled application is missing DLL
The accuracy of yolov7 in cracking down on counterfeits, not all papers are authentic
pytorch with torch.no_ grad
Research Summary / programming FAQs
Number of bytes occupied by variables of type char short int in memory
Leetcode high frequency question 56. merge intervals, merge overlapping intervals into one interval, including all intervals
佣金哪家券商最低,我要开户,手机上开户安不安全
异或程序
Existence form and legitimacy of real data in C language (floating point number)
REST风格