《MySQL必知必会》第六七章-过滤数据与数据过滤

WHERE子句:
SELECT prod_name, prod_price
FROM Products
WHERE prod_price = 3.49;

SELECT vend_id, prod_name
FROM Products
WHERE vend_id <> 'DLL01';

BETWEEN操作符:
SELECT prod_name, prod_price
FROM Products
WHERE prod_price BETWEEN 5 AND 10;

空值检查:
SELECT cust_name
FROM Customers
WHERE cust_email IS NULL;
 
  
操作符(operator):
用来联结或改变WHERE子句中的子句的关键字,也成为逻辑操作符。
AND操作符:
SELECT prod_id, prod_price, prod_name
FROM Products
WHERE vend_id = 'DLL01' AND prod_price <= 4;
OR操作符:
SELECT vend_id, prod_name, prod_price
FROM Products
WHERE vend_id = 'DLL01' OR vend_id = 'BR501';
求值顺序:
SELECT vend_id, prod_name, prod_price
FROM Products
WHERE (vend_id = 'DLL01' OR vend_id = 'BRS01')
                AND prod_price >= 10;
IN操作符:
SELECT vend_id, prod_name, prod_price
FROM Products
WHERE vend_id IN ('DLL01', 'BRS01')
ORDER BY prod_name;
NOT操作符:
SELECT vend_id, prod_name, prod_price
FROM Products
WHERE NOT vend_id = 'DLL01'
ORDER BY prod_name;

你可能感兴趣的:(《MySQL必知必会》学习笔记,《MySQL必知必会》读书笔记)