MySQL 二条件查询

MySQL条件查询

  1. 语法
    select 查询列表
    from 表名
    where 筛选条件
  2. 执行顺序
    (1)from (2)where (3)select
    eg:select last_name from employee where salary>2000;
  3. 特点:
    (1)按关系表达式筛选
    关系运算符:> < <= >= <>(不等于)
    补充:可以用!= 但是不建议
    (2)and or not
    补充:也可以用 && || ! 但是不建议
    (3)模糊查询
    in between and is null

案例分析
一:按条件表达式分析
eg:查询工资小于15000的姓名,工资
select last_name,salary
from employees
where salary <15000;
二:按逻辑表达式分析
案例一:查询部门编号不在50-100之间的员工姓名,部门编号,邮箱。
方法一:select last_name,department_id,email from employees where department_id<50 or department_id>100;
方法二:select last_name,department_id,email from employees where not (department_id>=50 and department_id<=100);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值