MySQL学习4 数据过滤
2017-02-22 16:43
316 查看
and 和 or 操作符
例
select prod_name ,prod_price
form products
where vend_id =1002 or vend_id=1003 and prod_price >=10; #这样会先处理 and部分的内容,再处理or的内容
例2
select prod_name ,prod_price
form products
where( vend_id =1002 or vend_id=1003) and prod_price >=10;
in 操作符
select prod_name , prod_price
form products
where vend_id in (1002,1003) #会与括号中的值逐个匹配,实际效果与 where vend_id = 1002 or vend_id=1003一样
order by prod_name;
not操作符
not操作符就是否定后面的任何条件
select prod_name , prod_price
form products
where vend_id not in (1002,1003)
order by prod_name;
例
select prod_name ,prod_price
form products
where vend_id =1002 or vend_id=1003 and prod_price >=10; #这样会先处理 and部分的内容,再处理or的内容
例2
select prod_name ,prod_price
form products
where( vend_id =1002 or vend_id=1003) and prod_price >=10;
in 操作符
select prod_name , prod_price
form products
where vend_id in (1002,1003) #会与括号中的值逐个匹配,实际效果与 where vend_id = 1002 or vend_id=1003一样
order by prod_name;
not操作符
not操作符就是否定后面的任何条件
select prod_name , prod_price
form products
where vend_id not in (1002,1003)
order by prod_name;
相关文章推荐
- MySQL学习足迹记录05--数据过滤--AND,OR,NOT,IN
- MySQL学习足迹记录07--数据过滤--用正则表达式进行检索
- MySQL学习足迹记录04--数据过滤--WHERE
- MySQL学习足迹记录06--数据过滤--LIKE搭配百分号(%)和下划线(_)通配符
- mysql学习 3 过滤数据
- Mysql学习3——查看表结构、修改和删除数据表
- MySQL: MySQL数据学习专题,揭示Google,百度,facebook,互动百科为什么选择MySQL做数据库
- MySQL服务器学习笔记!(三) ——视图/事物/锁,以及数据引擎
- Mysql学习点滴记录(2)--》数据的操作
- 简单学习PHP向MYSQL中插入数据的代码
- MySQL学习笔记20:数据备份与还原
- Mysql学习3——查看表结构、修改和删除数据表
- linux/windows xp下mysql数据的导入和导出(学习日志)
- MySQL学习之数据类型选择
- mysql学习之--3、mysql数据类型
- MySQL学习笔记10:修改数据
- 跟燕十八学习PHP-第二十一天-mysql添加数据
- MySQL入门很简单-学习笔记 - 第 4 章 MySQL数据类型
- MySQL学习笔记-得到一组数据的最新数据
- mysql学习笔记(4)创建数据表