Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8944173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:57:53+00:00 2026-06-15T11:57:53+00:00

Say I have a series of articles encoded in a database which are displayed

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:57:55+00:00Added an answer on June 15, 2026 at 11:57 am

    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

    • identify the user,
    • identify the article, and
    • identify the order.

    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.

    create table user_defined_order (
      user_id integer not null references users (user_id),
      article_id integer not null references articles (article_id),
      sort_order <sort_data_type> not null,
      primary key (user_id, article_id),
      unique (user_id, sort_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

    • integer without gaps (inserting requires rewriting a bunch of rows)
    • integer with gaps (insert into a gap, rewrite a bunch of rows when a gap closes)
    • float (insert halfway between existing floats, rewrite when splitting fails)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a series of pixels, which range from say -500 to +1000,
Let's say I have strings like this: PH&N 2015 LifeTime Series D PH&N 2020
Say I have two series: a and b, a = Series(None, index=['a','b','c']) b =
Let's say I have a series of xml files in this format: A.xml: <page>
Let's say I have two very long series - big and small index =
Let's say I have a series of elements designed to render via float:left inside
Let's say I have model app1.models.ModelOne defined with save decorated with @commit_on_success . All
I have a series of XML files which I need to add a few
Let's say I have a series of $_POST values, all of them structured like
Say you have an application with a series of actions. How would you write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.