Bhola
Bhola

Reputation: 412

Display Data from database in LIFO manner

Is there are any Way To Display Data From Database in LIFO Manner..

Its Default that Data Are Display In FIFO Manner

using id,timestamp we can display data in desc,asc format...

but

without any auto increment field can we display data in LIFO order, but without it possible or not

Upvotes: 0

Views: 331

Answers (1)

Davide Lorenzo MARINO
Davide Lorenzo MARINO

Reputation: 26946

You need to add a field with the creation timestamp and sorting your data using that field.

Note that using the id is not a good idea because is not granted that the values will be generated in order, it depends from many factors:

  • database used
  • if database is executing in a single instance or on multiple servers
  • caching algorithms used for generating ids faster

Upvotes: 2

Related Questions