0

I have a multi million table , lets say table1 ,I created another table table2 using the statement :

Create table table2 as select column1, column2 from table1 order by column1 column2;

Is there any surety that when fetching datas from table2 , it is fetched in the sane order it was inserted? For example :

SELECT column1,column2 from table2 limit 100000 offset 2000000;

should have the same result as

SELECT column1, column2 from table1 order by column1,column2 limit 100000 offset 2000000;

Is there any documentation from which i can confirm this? Iam using both oracle as well as postgres.

Roberto Hernandez
  • 8,231
  • 3
  • 14
  • 43
  • Take a look at this one https://stackoverflow.com/questions/17500013/in-order-sequence-generation – richyen Sep 09 '21 at 16:17
  • 3
    Relational table is a set. It has no any order, the only way to explicitly guarantee an order in SQL is to use `order by`. Just imagine partitioned table that is physically stored as different objects. What is the order of rows in it? – astentx Sep 09 '21 at 16:40

0 Answers0