当前位置:网站首页>select如果不加order by子句,返回结果的顺序是不可靠的
select如果不加order by子句,返回结果的顺序是不可靠的
2022-07-28 09:57:00 【不爱说话的小张】
前言
最近的项目设计到迁移国产化环境的事情,今天才测试迁移金仓数据库后的功能时,意外发现select 查询语句如果不加order by 语句指定排序规则,那么它的查询结果的顺序是不可靠的,刚开始还以为是人大金仓数据库的原因,后来翻阅了资料才知道原来select如果不加order by子句,返回结果的顺序是不可靠的。它的存储引擎,是否迁移过,修改,和添加和是否有索引都会影响到结果的顺序。
提示:以下是本篇文章正文内容,下面案例可供参考
一、select 语句不加order by 子句,返回结果是不确定的?
再次就不做太多的演示了,有兴趣的可以自己观察一下。
二、使用步骤
1.查询语句
代码如下(示例):
select * from student
2.加order by 查询语句
代码如下(示例):
select * from student order by id
总结
因select 语句不加order by 子句,查询的结果顺序是不可靠的,所以你想排序,总是要加上order by的。
边栏推荐
猜你喜欢

Flink - checkpoint Failure reason: Not all required tasks are currently running

巧用ngx_lua做流量分组

Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 2)

TCP Basics

The blind box of super primitive series will be launched soon, and platofarm will enable more rights and interests

Installing MySQL for Linux operating system (centos7)

软件设计师考前20问,注意啦!!

office2013以上输入数学公式

JS promotion: the underlying principle of flat tiling

每天在岗不足8小时被辞?腾讯前员工追讨1300万加班费等,法院终审获赔9万
随机推荐
2021-10-13arx
(10) Defer keyword
Introduction to evaluatorfilter
2021.07.13 我们是这样崩的
Cloudcompare & PCL matching point sampling consistency suppression
TCP Basics
Illustrate three mainstream enterprise architecture models (recommended collection!)
LinkedList源码按摩,啊舒服
线程同步volatile与synchronized详解
Flink - checkpoint Failure reason: Not all required tasks are currently running
每天在岗不足8小时被辞?腾讯前员工追讨1300万加班费等,法院终审获赔9万
什么样的知识付费系统功能,更有利于平台与讲师发展?
Irregular area of OSPF, LSA and serial number
选择供应商服务系统,是大健康产业企业迈向数字化转型的第一步
Introduction to timebasedrollingpolicy
LandingSite电子标签Quuppa固件进入DFU状态说明
Basic examples that must be mastered by beginners of C #
[openharmony] [rk2206] build openharmony compiler (2)
Description of landingsite electronic label quppa firmware entering DFU status
In retaliation for the dismissal of the company, I changed all code comments of the project!