SELECT*FROM customers
WHERE state ='VA'//表示筛选在VA的数据WHERE state <>'VA'//表示筛选不在VA的数据-- 注意:字符串需要用单引号引起WHERE birth_date >'1990-01-01'-- 筛选日期时,也要将日期用单引号引起。-- MySQL标准或默认日期表述形式:4位年份-2位月份-2位日期
-- 小小练习SELECT*FROM orders
WHERE order_date >='2019-01-01 '
AND,OR,NOT运算符
优先级:AND > OR
SELECT*FROM customers
WHERE birth_date >'1990-01-01'OR(points >1000AND state ='VA')
-- 小小练习SELECT*FROM order_items
WHERE order_id =6AND unit_price * quantity >30
IN运算符
SELECT*FROM customers
-- 查询多个条件时用OR比较麻烦WHERE state ='VA'OR state ='GA'OR state ='FL'-- 此时可以用IN运算符WHERE state IN('VA','FL','GA')-- 可用NOT IN查询不在IN范围内的WHERE state NOTIN('VA','FL','GA')
-- 小小练习SELECT*FROM products
WHERE quantity_in_stock IN(49,38,72)