select
語法:
select ... from ...
示例:
實(shí)例1:查詢?nèi)孔侄? select * from students
實(shí)例2:查詢單個或多個字段
select id,name from students
實(shí)例3:別名(換名)
select name 'namess' from student
where
語法:
... where 一個條件或者多個條件
示例:
實(shí)例1:篩選一個條件
where age>23
實(shí)例2:like篩選條件
where name like '%王%'
實(shí)例3:=、>、<、!=(或<>)
where id !=2
實(shí)例4:and、or、()
where (id<2) and (name='王小二')
order by
語法:
order by ... (如果不加,默認(rèn)就是asc升序)
示例:
實(shí)例1:單個字段升序排序
order by name asc (desc降序)
實(shí)例2:多個字段排序
order by name asc, id desc
limit
語法:
limit 起始數(shù)字,長度數(shù)
示例:
實(shí)例1:從第6行開始,查出8行數(shù)據(jù)
limit 6,8
實(shí)例2:查出前5行
limit 5