SQL: There is no default output order for SQL queries
There is a really common misconception about output order for T-SQL queries. I can’t tell you how often I’ve heard people say that if you don’t specify an ORDER BY clause, then you’ll see the rows returned in the order of the primary key.
The assumption they’re also making is that the primary key is the clustering key. And that’s not necessarily true either. You can have a non-clustered primary key on a table.
2025-08-02