#模糊查 likespa
select id from tbl_article where forward_title like '春%'; #從tbl_article查詢出forward_title字段中首字是春的id。it
select id from tbl_article where tel like '%5634'; #從tbl_article查詢出tel字段中尾字是5634的id。select
select id from tbl_article where forward_title like '%秋%'; #從tbl_article查詢出forward_title字段中含有夏的id。查詢
select id from tbl_article where forward_title like '冬_';#從tbl_article查詢出forward_title字段中含有冬某的id(_下劃線佔位,一個下劃線表明後面有一個字)。co
select * from tbl_article where forward_title like '春__';#從tbl_article查詢出forward_title字段中含有冬某某的全部信息。
#BETWEEN and
select * from tbl_article where age between '20' and '50';
select * from tbl_article where age between 20 and 50;#查找年齡在20與50之間的人的全部信息
#大於 小於 等於 不等於 and or
select * from tbl_article where age ='21';#查找21歲的人的全部字段的值
select * from tbl_article where age<='50' and age>='20';
select * from tbl_article where age<='20' or age>='50';
select * from tbl_article where age<'40' or age>'40';#年齡不是四十歲的人的全部字段
select * from tbl_article where age<>'40';#年齡不是四十歲的人的全部字段
select * from tbl_article where age !='40';#年齡不是四十歲的人的全部字段
select id,content,tel from tbl_article where forward_title ='春天' or forward_title='秋天';#查詢forward_title爲春天和秋天的id,content字段信息
select * from tbl_article where age ='40' and home='信陽';#查詢信陽的40歲的人
select * from tbl_article where tbl_article<'80' and subject='語文';