在 Oracle 中,如果未指定order by"子句,则选择查询的默认行顺序是什么.
是吗
根据 Tom Kyte 的说法:除非您将order by"添加到查询中,否则您无法对返回的行的顺序发表任何看法.好吧,缺少您不能依赖返回的行的顺序"."
参见这个问题 在 asktom.com.
至于 ROWNUM,它在物理上并不存在,因此无法释放".ROWNUM 是在从表中检索记录后分配的,这就是为什么WHERE ROWNUM = 5"总是无法选择任何记录的原因.
@ammoQ:您可能想阅读 这篇 AskTom 文章 关于 GROUP BY 排序.简而言之:
<块引用><块引用>在查询中使用 Group By 子句保证输出数据为按分组依据列排序订单,即使没有 Order By条款?
我们说...
绝对不会,
从来没有,从来没有,从来没有会.
In Oracle, what is the the default ordering of rows for a select query if no "order by" clause is specified.
Is it
According to Tom Kyte: "Unless and until you add "order by" to a query, you cannot say ANYTHING about the order of the rows returned. Well, short of 'you cannot rely on the order of the rows being returned'."
See this question at asktom.com.
As for ROWNUM, it doesn't physically exist, so it can't be "freed". ROWNUM is assigned after a record is retrieved from a table, which is why "WHERE ROWNUM = 5" will always fail to select any records.
@ammoQ: you might want to read this AskTom article on GROUP BY ordering. In short:
Does a Group By clause in an Query gaurantee that the output data will be sorted on the Group By columns in order, even if there is NO Order By clause?
and we said...
ABSOLUTELY NOT,
It never has, it never did, it never will.
这篇关于oracle中选择查询的默认行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!