当前位置:网站首页>PHP MySQL Order By keywords
PHP MySQL Order By keywords
2023-01-19 15:32:04【T0620514】
The ORDER BY keyword is used to sort the data in the recordset.
ORDER BY keywords
The ORDER BY keyword is used to sort the data in the recordset.
The ORDER BY keyword sorts the records in ascending order by default.
If you want to sort in descending order, use the DESC keyword.
Grammar
SELECT column_name(s)FROM table_nameORDER BY column_name(s) ASC|DESC
To learn more about SQL, visit our SQL Tutorial.
Example
The following example selects all the data stored in the "Persons" table and sorts the results based on the "Age" column:
";}mysqli_close($con);?>
The above result will output:
Glenn Quagmire 33Peter Griffin 35
Sort by two columns
You can sort by multiple columns.When sorting by multiple columns, the second column is only used if the first column has the same value:
SELECT column_name(s)FROM table_nameORDER BY column1, column2
边栏推荐
猜你喜欢
随机推荐
- uni-app 178添加背景提示音(二)
- uni-app 181查看好友朋友圈完善(二)
- uni-app 180查看好友朋友圈完善(一)
- uni-app 176添加背景提示音(一)
- uni-app 175app端兼容处理(二)
- 关于双碳中的一些单位换算
- OpenMP 环境变量使用总结
- TiCDC 源码阅读(三)TiCDC 集群工作过程解析
- OpenMP 环境变量使用总结
- Inside OpenStack Technology
- MapReduce 实验:二次排序
- scrapy框架利用crawlspider全站爬取招聘信息
- scrapy爬虫框架全栈爬取招聘所有数据3000多条记录
- scrapy爬虫框架介绍与实战
- MeterSphere使用beanshell全局断言解决引用JSONObject问题
- 多种汉语方言语音落地应用,微软智能语音解锁更多交互场景
- 超越TensorFlow?Yann LeCun:“Why? PyTorch. That's why.”
- CTA-敏感行为-AppOps方案
- 年金保险排名前十的保险是哪个,安全吗
- 支付宝的年金保险值得入手吗?安全吗?
- 负电压是怎么产生的原理分析
- 迟滞比较器Hysteresiswindow和comparator(窗口比较器)原理
- 残留物与电子PCBA 的可靠性和三防漆涂敷前后可能导致电路板出现故障的变量
- 京东探索研究院 | 2023年十大科技趋势
- A variety of Chinese dialect voice landing applications, Microsoft's intelligent voice unlocks more interactive scenarios
- Is Alipay's annuity insurance worth buying?is it safe?
- Which is the top ten insurance for annuity insurance? Is it safe?
- Use MeterSphere beanshell global assertion reference JSONObject solution
- CNN+LSTM+Attention实现时间序列预测(PyTorch版)
- WebView加载heml代码简单应用
- CTA-Sensitive Behavior-AppOps Solution
- Beyond TensorFlow?Yann LeCun: "Why? PyTorch. That's why."
- 蜻蜓安全工作台程序编排简要说明
- WSL2安装systemd方法
- 安信证券开户安全吗?佣金是万几?
- 大智慧在上面开户安全吗?谁能告诉我一下
- 从合并石子学区间DP
- Golang的基本数据类型-基本使用
- 线扫相机DALSA--卡间同步
- 海康visionmaster-图像Bitmap和CmvdImage互转的方法



