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的

 

转载于:https://www.cnblogs.com/Be-your-own-hero/p/11312439.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值