Server version: 5.6.47 MySQL Community Server (GPL)
1.使用WHERE子句
SELECT prod_name,prod_price FROM Products WHERE prod_price=3.49;
2.检查单个值
SELECT prod_name,prod_price FROM Products WHERE prod_price<10;
SELECT prod_name,prod_price FROM Products WHERE prod_price<=10;
3.不匹配检查
SELECT vend_id,prod_name FROM Products WHERE vend_id<>'DLL01';
SELECT vend_id,prod_name FROM Products WHERE vend_id!='DLL01';
4.范围值检查
SELECT prod_name,prod_price FROM Products WHERE prod_price BETWEEN 5 AND 10;
5.空值检查
SELECT prod_name FROM Products WHERE prod_price IS NULL;
SELECT cust_name FROM Customers WHERE cust_email IS NULL;
网友评论