三、基礎查詢——MySQL數據庫之知識點拾遺(7)

三、基礎查詢——MySQL數據庫之知識點拾遺(7)

1.空值運算符

(1)常見的空值運算符

is nullis not null

(2)實例

示例1:

檢查score列的空值並取出該數據。

select * from student_score where score is null;

示例2:

檢查score列的非空值並取出該數據。

2.and和or的優先級問題

選擇num等於25或者35並且價格大於5的水果的所有信息。

select * from fruit where num=25 or num=35 and price>5;

select * from fruit where (num=25 or num=35) and price>5;

總結:and的優先級高於or。

 

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