Say I have a series of articles encoded in a database which are displayed on the front-end of a web site.
If support for custom-defined ordering is added, how could/should this be represented in the database ?
P.S: There might be a case where an article is displayed in more than one list.
The only way to store user-defined ordering in the database is as rows of data in tables. To do that, you need columns to
The first two are easy. There are several different ways to store the order. The design goal is usually to reduce the need to rewrite the order.
The last constraint,
unique (user_id, sort_order), is application-dependent.sort_data_type options
Different data types give you different options for inserting and for changing the order. The most commonly used are