当前位置:网站首页>MySQL common functions (summary)
MySQL common functions (summary)
2022-07-27 00:34:00 【·~Simple is good】
Mysql Common functions ( Summary )
One 、 Common digital processing functions
| Common digital processing functions | The name of the function | perform sql | Return results |
|---|---|---|---|
| ABS(x) | return x The absolute value of | SELECT ABS(-1); | 1 |
| AVG(expression) | averaging | select AXG(age) from student | Returns the average age |
| CEIL(x) | Greater than x Minimum integer of | SELECT CEIL(1.5); | 2 |
| CEILING(x) | Greater than x Or equal to x Minimum integer of | SELECT CEILING(1.5); | 2 |
| FLOOR(x) | Less than x Minimum integer of | SELECT FLOOR(1.5); | 1 |
| MAX(age) | Maximum | SELECT MAX(age) AS maxAge FROM Student; | Return to maximum age |
| POWER(x,y) | return x Of y Power | SELECT POWER(2,3); | return 2 Of 3 Power |
| RAND() | return 0 To 1 The random number | ||
| SUM(expression) | Returns the sum of the specified fields | SELECT SUM(age) FROM Student; | Age sum |
| SQRT(x) | return x The square root of | SELECT SQRT(25); | return 5 |
| TRUNCATE(x,y) | The number x Retain y position | SELECT TRUNCATE(1.23456,3); | return 1.234 |
| GREATEST(expr1, expr2, …) | Returns the maximum value in the list | SELECT GREATEST(3, 12, 34, 8, 25); | return 34 |
| LEAST(expr1, expr2, …) | Returns the minimum value in the list | SELECT LEAST(3, 12, 34, 8, 25); | return 3 |
Two 、 Common date functions
1、CURDATE()/CURRENT_DATE() Return current date
SELECT CURDATE();
SELECT CURRENT_DATE();
---- Return return current date
2、CURRENT_TIME()/CURTIME() Return current time
SELECT CURRENT_TIME();
---- return 17:40:45
3、CURRENT_TIMESTAMP() Returns the current date and time
SELECT CURRENT_TIMESTAMP();
---- return 2022-07-26 17:41:32
4、ADDDATE(d,n) Calculate start date d add n The date of day
SELECT ADDDATE("2017-06-15", INTERVAL 10 DAY);
---- return 2017-06-25
5、ADDTIME(t,n) Time t add n The second time
SELECT ADDTIME('2011-11-11 11:11:11', 5);
---- return 2011-11-11 11:11:16
6、DATE() Extract a date value from a date or datetime expression
SELECT DATE("2017-06-15 11:11:16");
---- return 2017-06-15
7、DAY(d) Returns the date value d The date part of
SELECT DAY("2017-06-15");
边栏推荐
- 【AcWing第61场周赛】
- 【AtCoder Beginner Contest 261 (A·B·C·D)】
- c语言 static运用,灵活改变生命周期,让你写代码如鱼得水
- [acwing game 61]
- Eight queens n Queens
- 2020-12-20 九九乘法表
- Mysql互不关联的联表查询(减少了查询的次数)
- Complete review of parsing web pages
- 2020-12-22最大公因数
- Reduced dimension mean dot product matrix multiplicative norm probability normal distribution square loss
猜你喜欢
随机推荐
【4.9 容斥原理详解】
Web middleware log analysis script 1.0 (shell script)
动态联编和静态联编、以及多态
MySQL associative table queries (reducing the number of queries)
13_集成学习和随机森林(Ensemble Learning and Random Forests)
[4.9 detailed explanation of inclusion exclusion principle]
Matlab based medical imaging technology filtering backprojection simulation, including direct backprojection, S-L filtering, R-L filtering, LeWitt filtering
Matlab simulation of inverted pendulum control system based on qlearning reinforcement learning
In JS, the common writing methods and calling methods of functions - conventional writing, anonymous function writing, taking the method as an object, and adding methods to the object in the construct
Inherit, inherit, inherit
Request attribute in crawler
【Codeforces Round #807 (Div 2.) A·B·C】
[Qt]容器类、迭代器、foreach关键字
Course notes of Professor Dalin of robotics platform
Lt9611ux Mipi to HDMI 2.0 dual port with audio
Reduced dimension mean dot product matrix multiplicative norm probability normal distribution square loss
Today's 20220719 toss deeplobcut
V-viewer use
Anaconda = > pycharm=> CUDA=> cudnn=> pytorch environment configuration
A simple prime number program. Beginners hope that older bosses can have a look




![[Qt]容器类、迭代器、foreach关键字](/img/88/d9d5be096009b4e5baa0966e6f292c.jpg)




