当前位置:网站首页>数据库 逻辑处理功能
数据库 逻辑处理功能
2022-07-05 18:44:00 【我的天才女友】
函数
数值函数
- abs(x) 绝对值
- ceil(x) 大于等于x的最小整数
- floor(x) 小于等于x的最大整数
- mod(x,y) x除以y的余数
- round(x,n) 将x四舍五入到n位小数
- rand() 返回一个随机数
字符函数
- char_length(s) 字符长度
- concat(a,b) 字符连接
- instr(s,s1) 返回字符第一次出现的位置,不区分大小写
- lower(a) / upper(b) 大小写转化
- octet_length(s) 返回字符字节长,utf-8字符占据3个字符
- substring(s,n,m) 截取字符从n开始的m个字母,位置计算从1开始
- trim(s1 from s) 删除开头和结尾的字符,默认是空格
日期函数
- current_date 当前日期
- current_time 当前时间
- current_timestamp 当前时间和日期
- extract(p from date) 从日期中提取信息
- datediff(d1, d2) 计算日期之间的天数
- d1 + interval 日期加上时间间隔
select date ‘2011-11-12’ + interval ‘-1’ month t_goodss
转换函数
- cast
别名
列别名和表别名都使用关键字AS
条件表达式
case
case expression
when value1 then result1
when value2 then result2
else --
end
case
when conditon1 then result1
when conditon2 then result2
else --
end
if
if和java中的三目表达式差不多
select if(1<2, '1<2','1>=2') as result;
边栏推荐
- [HCIA cloud] [1] definition of cloud computing, what is cloud computing, architecture and technical description of cloud computing, Huawei cloud computing products, and description of Huawei memory DD
- Solutions contents have differences only in line separators
- A2L file parsing based on CAN bus (3)
- EasyCVR授权到期页面无法登录,该如何解决?
- cf:B. Almost Ternary Matrix【对称 + 找规律 + 构造 + 我是构造垃圾】
- 潘多拉 IOT 开发板学习(HAL 库)—— 实验8 定时器中断实验(学习笔记)
- 深入底层C源码讲透Redis核心设计原理
- R language uses lubridate package to process date and time data
- 华律网牵手观测云,上线系统全链路可观测平台
- 公司破产后,黑石们来了
猜你喜欢
随机推荐
EMQX 5.0 正式发布:单集群支持 1 亿 MQTT 连接
Word查找红色文字 Word查找颜色字体 Word查找突出格式文本
Tianyi cloud understands enterprise level data security in this way
2022最新中高级Android面试题目,【原理+实战+视频+源码】
为什么 BI 软件都搞不定关联分析?带你分析分析
Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core
1亿单身男女撑起一个IPO,估值130亿
XML基础知识概念
深入底层C源码讲透Redis核心设计原理
2022 the most complete Tencent background automation testing and continuous deployment practice in the whole network [10000 words]
达梦数据库udf实现
Shang Silicon Valley Shang preferred project tutorial release
如何快速进阶自动化测试?听听这3位BAT大厂测试工程师的切身感想....
ROS installation error sudo: rosdep: command not found
CDB 实例的启动与关闭
How to write good code defensive programming
Go语言学习教程(十五)
The era of Web3.0 is coming. See how Tianyi cloud storage resources revitalize the system to enable new infrastructure (Part 2)
Mathematical modeling of oil pipeline layout MATLAB, mathematical model of oil pipeline layout
Oracle date format conversion to_ date,to_ char,to_ Timestamp mutual conversion