Does 'Select' always order by primary key?

前端 未结 6 984
无人共我
无人共我 2020-12-01 18:14

A basic simple question for all of you DBA.

When I do a select, is it always guaranteed that my result will be ordered by the primary key, or should I specify it wit

6条回答
  •  醉话见心
    2020-12-01 18:53

    It depends on your DB and also it depends on indexed fields.

    For example, in my table Users every user has unique varchar(20) field - login, and primary key - id.

    And "Select * from users" returns rowset ordered by login.

提交回复
热议问题