I
I
iluxa18102016-02-13 21:43:07
SQL
iluxa1810, 2016-02-13 21:43:07

How to sort by primary key only?

There is a table, it has a primary key on a digital field and a unique index on the title (Text).
After an arbitrary selection, IDs do not go in ascending order, but it is not clear how.
As I understand it, sorting is also performed by the text field ... Is it possible somehow to sort only by the primary key without using order by, or with this combination, you will always have to do a forced sorting of the results?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Aleksey Ratnikov, 2016-02-13
@mahoho

The order of SELECT results is not deterministic without the explicit use of ORDER BY.

D
drc, 2016-02-15
@drc

and why order by by primary key is bad?

A
AxisPod, 2016-02-16
@AxisPod

Yes, it is necessary to specify explicitly always sorting.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question