where用法
#####查詢where後面條件的數據
SELECT * from runoob_tbl WHERE runoob_author='菜鳥教程';
SELECT * from runoob_tbl WHERE runoob_author>1 AND runoob_author<=8;
//下面也是兩個之間
select * from scores where score between 2500 and 3000;
模糊查詢like用法
用like關鍵字查詢
//%代表n個元素,_ 代表的是一個元素
SELECT * from user WHERE user_name like ‘%李%’;
//查詢所有非姓李 元素
SELECT * from user WHERE user_name not like ‘李%’;
查詢null用法
null表示爲空
//查詢所有元素爲空的
SELECT * from user WHERE user_bir is null;
//查詢所有非空元素
SELECT * from user WHERE user_bir is not null;
對查詢結果排序
用
//查詢所有元素爲空的
SELECT * from user WHERE user_bir is null;
//查詢所有非空元素
SELECT * from user WHERE user_bir is not null;