当前位置:网站首页>[MySQL learning notes 11] sort query

[MySQL learning notes 11] sort query

2022-06-21 17:26:00 yqs_ two hundred and eighty-one million eight hundred and seven

Basic grammar

select Field list from Table name order by Field 1 sort order 1, Field 2 sort order 2,…

sort order

asc: Ascending ( Default sort )
desc: Descending

practice

# Sort employees in ascending order by age 
select * from emp order by age asc;
# According to the employment time , Sort employees in descending order 
select * from emp order by entrydate desc;
# Sort in ascending order by age , If the age is the same, it will be sorted in descending order according to the employment time 
select * from emp order by age asc,entrydate desc;
原网站

版权声明
本文为[yqs_ two hundred and eighty-one million eight hundred and seven]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206211409238812.html