靓丽时尚馆

位置:首页 > 健康生活 > 心理

sql排序倒序怎么写

心理1.04W
sql排序倒序怎么写

sql中排序倒序使用desc关键字,一般需要和order by 合用,示例sql语句如下:

例如:select * from student order by age desc

意思是查询学生表,以学生年纪倒序排列。

排序采用 order by 子句,order by 后面跟上排序字段,排序字段可以放多个,多个采用逗号间隔,order by默认采用升序(asc),如果存在 where 子句,那么 order by 必须放到where 语句后面。

标签:倒序 sql