would you say it is safe to assume that output returned by
select * from table1;
will be ordered in the same way as the output of:
select * from table1 where table1.a<0;
where a is some random attribute of table1?
thanks!
would you say it is safe to assume that output returned by
select * from table1;
will be ordered in the same way as the output of:
select * from table1 where table1.a<0;
where a is some random attribute of table1?
thanks!
If you mean columns then I have never seen it different from the order when edit table in SSMS but I am not sure if that is a hard rule.
There is no inherent order to rows. In absence of a sort the exact same query is not guaranteed to return rows in the same order each time.
this will be the same
select * from table1
order by table1.PK;
select * from table1 where table1.a<0
order by table1.PK;
even a table with a clustered PK is not guaranteed to return rows in that order without an order by clause
This has to be a dup. I will look for one and delete.
The order of the column is defined in database schema so you should consider the returned sequence of column in select *
alway the same (for changing the column sequence there are specific command that alter this value in schema, is a variant of alter table)
the order of the row no .. if you want to be sure of a specific order by result for the selected rows you must explicitally set using a order by clause
select * from your_table
order by your_column