当前位置:网站首页>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");
边栏推荐
猜你喜欢

Dynamic binding, static binding, and polymorphism

Arcgis和Cass实现断面展高程点
![[acwing game 61]](/img/83/c9a43536705451a60252720fc41d14.jpg)
[acwing game 61]

Transpose convolution correlation

Leetcode high frequency question: the choice of the inn, how many options to choose accommodation, to ensure that you can find a coffee shop with a minimum consumption of no more than p yuan in the ev

Three tier architecture simulation

Matlab simulation of inverted pendulum control system based on qlearning reinforcement learning

Leetcode topic - array

13_ Ensemble learning and random forests

SSRF (server side request forgery) -- Principle & bypass & Defense
随机推荐
Convolutional neural network -- lenet (pytorch Implementation)
C language shutdown applet
Dynamic binding, static binding, and polymorphism
Visual studio C cs0006 C failed to find metadata file
[4.4 detailed explanation of fast power and inverse element of fast power]
V-viewer use
AutoCAD的卸载后重新安装,删除注册表的详细过程
解析网页的完整回顾
Configure deeplobcut2 with your head covered
爬虫中Request属性
放图仓库-2(函数图像)
公司给了IP地址如何使用(详细版)
Looking for the real murderer
7_ Principal component analysis
爬虫解析网页的find方法
【Codeforces Round #807 (Div 2.) A·B·C】
Friend友元函数以及单例模式
Pyautogui usage example
Mysql互不关联的联表查询(减少了查询的次数)
【3. 基础搜索与图论初识】