I have a table feeds that contains a collection of code-description rows. e.g.
Key | Value | Url
fb | facebook | http://www.facebook.com
tw | twitter | http://twitter.com
ff | friendfeed | http://friendfeed.com
A REST endpoint returns the contents of this table as a JSON array & it is displayed in a drop down box of a web page.
Today the boss wants the contents to be sorted in a specific manner. And I would like you to comment on my designs.
Design 1
I add a separate column into feeds called rank to denote the order of the item.
Key | Value | Url | Rank
fb | facebook | http://www.facebook.com | 3
tw | twitter | http://twitter.com | 1
ff | friendfeed | http://friendfeed.com | 2
Design 2
I create a separate table FeedRank that stores the rank.
Key | Rank
fb | 3
tw | 1
ff | 2
Analysis
I am leaning towards design #1 because I can dispense with the JOIN. What are the pros and cons of each design & which one would you use ?
Thanks