11-15-15, 08:08 #1Registered User
- Join Date
- Nov 2015
Unanswered: is there a default "order by" (not alphanumeric sorting).
I have a table with 10 columns on sybase ase. ver 5.(very old..).
first 5 are logical keys and last 5 are results.(K1,K2,..K5, R1,R2,...R5).
There aren't any PK's.
There is index on all first 5 columns.
By mistake, we inserted many duplicate rows into the table. meaning, all the first 5 columns are duplicate but the results (last 5 columns) are different.
all columns are numeric.
My questions are, is there an inner sorting/ordering mechanism that acts where there is no "order by" statement ? how can i be sure that when my results are duplicate, they come in the same order ?
id age height weight salary code
1 ,30 ,1.80 ,75 ,10,000 ,4
1 ,30 ,1.80 ,75 ,10,000 ,2
1 ,30 ,1.80 ,75 ,10,000 ,3
select code from tbl_1 where id = 1 and age = 30 and height = 1.80 and weight = 75 and salary = 10000;
what will be the order ? is it always that order ?
11-15-15, 13:51 #2Resident Curmudgeon
Provided Answers: 54
- Join Date
- Feb 2004
- In front of the computer
A general answer is simple, but a specific answer is impossible.
In general, the rows will be returned in a consistent order. In other words if you execute a given SELECT statement 100 times then the odds are that you'll get the same result set 100 times.
Technically there are many other factors that can influence the order of a return set when no ORDER BY clause is specified. The sequence is up to the database engine, and it may change unless you provide an ORDER BY clause.
-PatPIn theory, theory and practice are identical. In practice, theory and practice are unrelated.