between and (区间查询,前后临界值都包含,临界值不能调换位置)
select * from tablenName where columName between 10 and 89
in关键字,查询包含关系的数据
select * from tablenName where columName in(1,100,99)
is null和is not null 判断空值 绝不能用=null这种方式
select * from tablenName where columName is not null
求字符串长度
select length('name')
字符串拼接
select concat(columName1,'-----',columName2) from tablenName
小写转换成大写
select upper('aaaaaaaaaa')
大写转成小写
select lower('AAAAAAA')
截取字符 substr substring 从1开始 substr=substring,以下返回’德玛’
select substr('德玛西亚之力',1,2)
查询最大
select max(columName) from tablenName
查询最小
select min(columName) from tablenName
四舍五入保留两位小数,以下返回0.56
select round(0.555555555555,2)
向上取整,以下返回2
select ceil(1.00001)
向下取整,以下返回1
select floor(1.999)
truncate 按照保留多少位 截断数字,以下输出10.23699
select truncate(10.23699696,5)
取余数,以下两种方式都可以,都返回1
select mod(100,3);
select 100%3;
日期函数
返回当前日期加时间
select now()
返回日期不包含时间
select curDate()
返回当前时间 不包含日期
select curTIme()
if判断输出对印的值
select if(enabled,'是','否') from tablenName