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;