mysql-单行函数

函数

一、单行函数

1.数学相关函数

1.1 数值函数

image

1.2 角度弧度互换

image

1.3 三角函数:其中的参数是弧度,所以应先将角度换算成弧度在使用该函数

image

1.4 指数与对数

image

1.5 进制转换

image

2. 字符串函数


image

3.日期与时间类型的函数

3.1获取日期时间

image

select CURRENT_DATE(),CURRENT_TIME(),NOW(),SYSDATE(),UTC_DATE(),UTC_TIME()
from DUAL;

3.2日期时间戳的转换

image

3.3获取月份,星期,星期数,天数等函数

image

3.4日期操作函数

image
image

3.5

image

3.6 计算日期与时间的函数

image
image

image

3.7 日期和时间的格式化与解析

image
image
image
image

4. 流程控制函数

image

#when ... when ... else ... end 的使用

select last_name,salary,
case when salary > 15000 then '大佬'
when salary >10000 then '中佬'
when salary >5000 then '小佬'
else '草根' end as detail
from employees;
posted @ 2023-02-01 10:08  阿远不颓废!  阅读(13)  评论(0)    收藏  举报