Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Is a Sort Column okay?

1. ## Is a Sort Column okay?

I just finished adding Section, Dimension, and SubSection columns to my database.

When I start joining the tables in various ways, I am not getting things in the order I want.

Would it be okay to add a column called "sort" and manually assign a "Sort Order #" so I have something on which to run my ORDER BY against?

For example, I want things in this order...
Code:
```Featured Finance
Store Type
Offering
Accounting```

Also, if it is okay to do this for one table, would it be a major deal to do it on several tables, e.g. my Section, Dimension, and SubSection tables?

Sincerely,

Debbie

• Sure. I do this all the time.

But take a hint from the olden days of when BASIC had line numbers and most people numbered their lines in increments of 10 ( 10, 20, 30, ... ).

Do that with your ordering column.

Now, if you change your mind about one number, you don't have to shuffle all the numbers around.

Say you had, indeed,
10
20
30
40
and you decided the 30 really should be before 20. So just change 30 to 15.
10
15
20
40
Presto.

(Heck, I can remember numbering by 100 on occasion.)

• Originally Posted by Old Pedant
Sure. I do this all the time.
That's good, because while I love my new Data Model, I found out pretty quickly last night that my "Natural Keys" in the junction tables were very short lived as far as simplifying my queries...

But take a hint from the olden days of when BASIC had line numbers and most people numbered their lines in increments of 10 ( 10, 20, 30, ... ).

Do that with your ordering column.

Now, if you change your mind about one number, you don't have to shuffle all the numbers around.

Say you had, indeed,
10
20
30
40
and you decided the 30 really should be before 20. So just change 30 to 15.
10
15
20
40
Presto.

(Heck, I can remember numbering by 100 on occasion.)
Thanks for the tip!

Sincerely,

Debbie

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•