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;

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