select 字段名 from 表名;
select 字段名,字段名 from 表名;
select 字段名 別名 from 表名;//若別名中有空格,或者是中文叛氨,用' '包起來
select 字段名*12 from 表名;//字段可以使用數(shù)學(xué)表達(dá)式
-
select
字段1,字段2..
from
表名
where
條件;
image.png and和or同時出現(xiàn)時,會先執(zhí)行and,對or加括號可優(yōu)先執(zhí)行
in不是區(qū)間
select xx
from xx
where
xx in (a,b,c). //xx=a,b,c 其中的一個即可-
like模糊查詢
image.png
image.png
image.png
-
排序
order by xx(desc降序 )//默認(rèn)升序
image.png -
單行處理函數(shù)和多行處理函數(shù)
image.png
image.png
- group by a,b //根據(jù)a,b分組
image.png
image.png
image.png