mysql专栏 05.关键字 01.where过滤

01.where 过滤

[toc]{type: “ol”, level: [2, 3, 4, 5]}

基础概念
select * from table_name\G 单独展示每一行的数据
书写顺序:
    select id,name from emp where id > 3;
执行顺序:
    from  -->  where  -->  select
查询 3 <= id <= 5 的数据:
select id,name from emp where id >= 3 and id <= 5;
select id,name from emp where id between 3 and 5;
查询 id < 3 或 id >5 的数据:
select id,name from emp where id not between 3 and 5;
查询薪资为10000或12000的数据:
select name,salary from emp where salary in (10000, 12000);
select name,salary  from emp where salary = 12000 or salary = 10000;
查询薪资不为10000或12000的数据:
select name,salary from emp where salary not in (10000, 12000);
查询员工姓名中包含字母i的数据:
select id,name from emp where name like '%i%';
查询姓名由3个字符组成的数据:
select id,name from emp where name like '___';
select id,name from emp where char_length(name) = 3;
查询岗位描述为null的数据:
select id,name from emp where post_comment is null;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值