mysql-4

*IFNULL

IFNULL(column,value) 如果column对应的值为null,value可为设置的返回值给该列

*条件查询

select column from 表名 where 条件表达式

条件运算符: < ,>,<>(!=),>=,<=

逻辑运算符:and ,or ,not 

模糊查询:like(%代表任意个字符,_任意单个字符,\转义或则escape),between and ,in ,is null

select nam from stduent where name like "__a%"  查找名字第三个为a的

select name from student where name like "%a%" 查找名字中包含a的

select name from student where name like "-\-%"  查找名字第二个为_的    或者  name like "_&%" escape &

select id from student where id between 3 and 5 查找学生id为3到5的 (包含3和5)

select class from student  where class in ("2班”,“3班”,“4班”) 查询学生所有在2,3,4,班的学生

select saraly from student where saraly is null 查询学生零花钱是null的

select saraly from student where saraly is not null 查询学会零花钱不是null的

 

posted @ 2019-08-06 23:00  Be_your_own_hero  阅读(97)  评论(0编辑  收藏  举报