WHERE 子句 MySQL條件檢索詳細用法

2021-09-27 08:06:00 字數 728 閱讀 3336

3、多條件檢索

學習 mysql,整理語法知識,可以開啟左側的「mysql基礎」專欄檢視全系列筆記

操作符意義=

等於<>

不等於!=

不等於<

小於<=

小於等於

>

大於》=

大於等於

between

在指定的兩個值之間

select column

fron list

where condition;

# 如 where price < 10;

select column

fron list

where condition;

# 如 where price in (10,11,12);

# 選出 price 為 10 或 11 的資料列

where ... not in  

where ... not between

where ... not exists

select column

fron list

where condition1 and condition2;

# 如 where price < 10 and id = 1;

where子句查詢

使用where關鍵進行查詢結果篩選 select 欄位名,欄位名,from表名 where 篩選條件 單條件篩選 單篩選條件 使用運算子進行篩選 單個條件中 注意 如果條件中的值為字元,必須使用單引號括起來 查詢所有的員工的工資資訊 select empno,ename,sal comm as 薪資...

Mysql效能優化 where子句優化

a and b and c or a and b and c and d a and b and c or a and b and c and d aand b c and a 5 b 5 and b c and a 5 b 5 and b 5 or b 6 and5 5 or b 7 and5 6...

MySql 使用where子句過濾資料

示例使用的資料表在上乙個部落格中建立的 示例如下 查詢 等於10.5的行 select from commodity where price 10.5 輸出 1 1001 牙刷 10.5 上個示例中,我們使用到了 這個操作符,下面列出所有條件操作符 where操作符 等於 不等於 不等於 小於 大於...