3、过滤数据

使用select语句的where子句指定搜索条件。

一、使用where子句

在select语句中,数据根据where子句中指定的搜索条件进行过滤,where子句在表名之后给出。

select prod_id, prod_price, prod_name from products where prod_price = 2.5;

二、使用where子句操作符

where子句操作符。

2.1 检查单个值

select prod_id, prod_price, prod_name from products where prod_price = 2.5;

2.2不匹配检查

select prod_id, prod_price, prod_name from products where prod_price <> 2.5;

2.3范围值检查

select prod_id, prod_price, prod_name from products where prod_price between 4 and 6;

2.4空值检查

select prod_id, prod_price, prod_name from products where prod_price is not null;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章