3.過濾數據
1.使用where子句
select * from table where field1 = 1;
2.where子句操作符
操作符 說明
= 等於
<> 不等於
!= 不等於
< 小於
> 大於
>= 大於等於
BETWEEN 在兩數之間
1.檢查單個值
select * from table where field1 = 'good';
2.不匹配查詢
//查詢出字段field1不等於10的數據
select * from table where field1 <> 10;
3.範圍查詢
//查詢字段field1在範圍5到8之間的數據(相當於>=5且<=10)
select * from tabel where field1 BETWEEN 5 AND 10;
4.空值查詢
//查詢字段field1爲空的數據
select * from table where field1 IS NULL;