好像是按插入顺序,但不确定create table t(id varchar(10)); insert into t values ('1'); insert into t values ('4'); insert into t values ('3'); insert into t values ('2'); insert into t values ('1'); insert into t values ('7'); insert into t values ('6'); insert into t values ('6'); commit; SQL> select * from t;
ID ---------- 1 4 3 2 1 7 6 6
8 rows selected
好像是按插入顺序,但不确定 create table t(id varchar(10)); insert into t values ('1'); insert into t values ('4'); insert into t values ('3'); insert into t values ('2'); insert into t values ('1'); insert into t values ('7'); insert into t values ('6'); insert into t values ('6'); commit;SQL> select * from t;
ID ---------- 1 4 3 2 1 7 6 6
主要是根据数据的存储位置排序: 1、对于非分区表、无索引、无并行的情况下oracle默认是按照extent_id和rowid来联合排序,即order by extent_id,rowid 2、对于分区表、无索引、无并行的情况下oracle默认是按照partition_position、extent_id和rowid来联合排序,即order by partition_position,extent_id,rowid
其实是用 rowid来排序的select a.*,a.rowid from test a...你试下就知道了...
--------------------
默认是不排序的。是Oracle根据数据文件记录顺序读取。加快效率
不是主键。你可以试一下。
要是这样的话就是oracle内部的操作了 现在的问题就成了结果不一样 那select * from就没有特定的规则
结果一样select * from就有特定的规则,这规则是什么?
好像是按插入顺序,但不确定create table t(id varchar(10));
insert into t values ('1');
insert into t values ('4');
insert into t values ('3');
insert into t values ('2');
insert into t values ('1');
insert into t values ('7');
insert into t values ('6');
insert into t values ('6');
commit;
SQL> select * from t;
ID
----------
1
4
3
2
1
7
6
6
8 rows selected
create table t(id varchar(10));
insert into t values ('1');
insert into t values ('4');
insert into t values ('3');
insert into t values ('2');
insert into t values ('1');
insert into t values ('7');
insert into t values ('6');
insert into t values ('6');
commit;SQL> select * from t;
ID
----------
1
4
3
2
1
7
6
6
1、对于非分区表、无索引、无并行的情况下oracle默认是按照extent_id和rowid来联合排序,即order by extent_id,rowid
2、对于分区表、无索引、无并行的情况下oracle默认是按照partition_position、extent_id和rowid来联合排序,即order by partition_position,extent_id,rowid