首页 > 数据库 >Mysql基础第十天,数据过滤

Mysql基础第十天,数据过滤

时间:2022-10-14 16:39:57浏览次数:43  
标签:第十天 price vend 过滤 Mysql prod id select name


1.组合WHERE子句

Mysql基础第十天,数据过滤_操作符

select prod_name,vend_id,prod_price from products where vend_id=1003 and prod_price=2.5;  // 使用and
select prod_name,vend_id,prod_price from products where vend_id=1010 or prod_price>=10; // 使用or
select prod_name,vend_id,prod_price from products where vend_id=1002 and vend_id=1003 or prod_price>=10; // 使用and和or

2.in操作符

Mysql基础第十天,数据过滤_操作符_02

select vend_name,vend_city from vendors where vend_city in ('New York','Lundon','paris');  // in 查询

3. NOT 操作符

Mysql基础第十天,数据过滤_操作符_03

select vend_name,vend_city from vendors where vend_city not in ('New York','Lundon','paris');  // not 查询

4.小结

Mysql基础第十天,数据过滤_操作符_04

感谢观看


标签:第十天,price,vend,过滤,Mysql,prod,id,select,name
From: https://blog.51cto.com/u_15565664/5757429

相关文章

  • Mysql基础第十一天,用通配符进行过滤
    LIKE操作符selectcust_namefromcustomerswherecust_namelike'%ou%';//%通配符%ou以ou结尾ou%以ou开头%ou%中间包含ouselectcust_namefromcustomerswh......
  • Mysql基础第十二天,用正则表达式进行搜索
    基本字符匹配selectpro_namefromproductswhereprod_nameregexp'ee';//基本字符匹配selectpro_namefromproductswhereprod_nameregexp'.00';//含有00,前......
  • 布隆过滤器简单使用
    参考:https://www.jb51.net/article/248125.htmhttps://blog.csdn.net/wang0112233/article/details/123665461https://blog.csdn.net/qq_40179653/article/details/1257......
  • Ubuntu 22.04 二进制安装 MySQL 8.0.31,安装MysqlWorkbench 及Test_db
    二进制安装MySQL​下载MySQL安装包wgethttps://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.31-linux-glibc2.12-x86_64.tar.xz安装依赖包sudoapt-getinstalllibai......
  • MySQL索引(下)
    MySQL索引(下)该文摘抄自林晓斌老师的文章在上一篇文章中,介绍了InnoDB索引的数据结构模型,今天我们再继续聊聊跟MySQL索引有关的概念在开始这篇文章之前,我们先来看一下......
  • pymysql封装
    1importpymysql2fromconfigs.global_dataimportMysql3frompymysql.cursorsimportDictCursor456classMysqlHandler:78def__i......
  • 记一次Mysql的修复
    现象:生产环境的MySql无故停止,版本是5.7,启动后马上就又停止,不知道原因 错误日志如下:InnoDB:Endofpagedump2022-10-14T05:43:37.668007Z0[Note]InnoDB:Unc......
  • mysql创建索引的语句
     1. altertable table_name addindexindex_name(column) 2.altertabletable_nameaddprimarykey(column)/addunique主键索引或者唯一值索引 3.cre......
  • MySQL索引(上)
    MySQL索引(上)该文摘抄自林晓斌老师的文章索引是一种数据结构,索引的出现其实就是为了提高数据查询的效率,就像书的目录一样。一本500页的书,如果你想快速找到其中的某一个知......
  • 1.0 Mysql索引的数据结构与算法
    索引是高效获取排序好的数据结构索引本身就是数据一部分关键信息,通过索引大大减少索引的数据量。索引信息需要额外的空间存储。创建和维护索引本身也会降低对数据的操作......