Page 1 of 1

Database Sorting Structure

Posted: Fri Jul 11, 2003 11:28 am
by kendall
Hello,

I have a question that i need some advice on

i have a database which lists a catalog of products. I want to be able to display these products sorting it based on an order of priority.

now i thought of 2 options

1 altering the code (primary key) - i wanted to do this option into a squencial format but i did not want to tamper with it as the data is related its real life inforamtion.

2 creating a sort column in which would create a sequence sort number but what i would run into problems when i have a new product entered and it needs to be more priority than those already there.



[quote]
What methods of sorting do you guys use in a situation like this?
[/quote]

[quote]
what options do i have or what should be my most effecient option?
[/quote]

Kendall

Posted: Fri Jul 11, 2003 2:09 pm
by nielsene
Definately add a new column. Add an index on that column. Use program logic to shift priorities if you have to insert a new one between existing ones.

The index will ensure that the sort is quickly preformed. If priorities change from time to time, then priority should definately not be the primary key.

Database Sorting Structure

Posted: Mon Jul 14, 2003 12:13 pm
by kendall
Ok...I understand that...now im no sure how to go about formaulating this 'sort' column...ah mean how to i create this data to define whats priority and whats more priority than what was priority? do is use numeric, alpha ar ture or false wat?? is there somewhere i can possible get and example to follow???

Kendall