查詢的完整格式
SELECT select_expr [,select_expr,...] [
FROM tb_name
[WHERE 條件判斷]
[GROUP BY {col_name | postion} [ASC | DESC], ...]
[HAVING WHERE 條件判斷]
[ORDER BY {col_name|expr|postion} [ASC | DESC], ...]
[ LIMIT {[offset,]rowcount | row_count OFFSET offset}]
]
select distinct *
from 表名
where ....
group by ... having ...
order by ...
limit start,count
- 執(zhí)行順序?yàn)椋?
- from 表名
- where ....
- group by ...
- select distinct *
- having ...
- order by ...
- limit start,count
- 實(shí)際使用中,只是語句中某些部分的組合凡桥,而不是全部
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者