沈阳格力专卖店 发表于 2018-10-10 11:59:49

MySQL学习4 数据过滤

  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;

页: [1]
查看完整版本: MySQL学习4 数据过滤