where子句
例子,在products里检索prod_name,prod_price,但是不返回所有行,只返回prod_price=2.50的行
select prod_name,prod_price
form products
where prod_price = 2.50;
where子句操作符
=等于
<>不等于
!=不等于
<小于
<=小于等于
>大于
>=大于等于
between在指定2个值之间
一个类似的例子:
select prod_name,prod_price
form products
where prod_name=’fuses’;
另外一个例子
select prod_name,prod_price
form products
where prod_price <10;
另一个例子
between的使用
select prod_name,prod_price
form products
where prod_price between 5 and 10;
另一个例子
检查空值 空值为null
select prod_name
form products
where prod_price is null;
原文:http://huzhongliang.blog.51cto.com/1817180/1900196