ORDER BY 排序 从小到大
SELECT district ,SUM(population)
FROM city
WHERE countrycode='CHN'
GROUP BY district
ORDER BY SUM(population) ;
--- 例子:查询中国所有的城市,并以人口数降序输出
SELECT *
FROM city
WHERE countrycode='CHN'
ORDER BY population DESC;人口数从大到小输出
ORDER BY 排序 从小到大
SELECT district ,SUM(population)
FROM city
WHERE countrycode='CHN'
GROUP BY district
ORDER BY SUM(population) ;
--- 例子:查询中国所有的城市,并以人口数降序输出
SELECT *
FROM city
WHERE countrycode='CHN'
ORDER BY population DESC;人口数从大到小输出
本文标题:select 配合order by 排序
本文链接:https://www.haomeiwen.com/subject/pxurlctx.html
网友评论