lets say I have
create table mytable(
a VARCHAR(200)
b VARCHAR(200)
c VARCHAR(200)
)
create index on mytable (b)
if I select
select a, b, c from mytable;
would it be sorted by b?
Perhaps (more likely in the case of clustered indexes I would imagine), but you cannot rely on this or expect it. Unless you have an order by
, assume it will not be ordered.
You should never assume that data returned by a query to a RDBMS will be in any particular order. The only way to be certain that the data is ordered is to explicitly request (generally with the ORDER BY
clause) for the database engine to sort and order the data returned by the query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With