select concat('hello','world'); 字符串拼接
select length('helloworld'); 显示字符长度
select trim(' hello '); 去除空格
select ltrim(' hello '); 去除左边空格
select rtrim(' hello '); 去除右边空格
select upper('hello'); 转换成大写
select replace('aaabbb','a','c'); 字符串替换
字符串的比较;
select substring('abcdefg',3,4); 字符串的提取从第三个开始提取四个
查看时间的函数
select now(): 查看时间和日期
select curdate(); 查看日期
select curtime(); 查看时间
select month(curdate()); 返回月份
select monthname(curdate()); 返回月份英语显示
select dayname(curdate()); 查看周几
select dayofweek(curdate()); 查看周几数字显示(1代表周日)
select weekday(curdate()); 查看周几数字显示(0代表周1)
select week(curdate()); 查看本周是今年第几周
select week('2022-12-30'); 查看日期是今年第几周
select dayofyear(curdate()); 今天是今年第几天
select dayofmonth(curdate()); 今天是本月第几天
select year(curdate()); 查看年份
select quarter(curdate()); 查看季度
select minute(now()); 现在几分
select second(now()); 现在几秒
set @dt=now(); 设置变量(变量时间不变)
select adddate(@dt,interval 1 day); 设置变量加一天
select subdate(@dt,interval 1 day); 设置变量减一天
select datediff('2022-03-09','2001-04-13'); 查看从第二个日期到第一个日期多少天