I have the following table situation
- Movie (int movieId PK)
- Cast (int castId PK)
- MovieHasCast (movieId, castId Unique Constraint)
When I insert the cast, they are inserted in a specific order (i.e. as they would appear on say IMDB). However, when I do a select they seem to come back in a different order.
My problem with this is 2 things.
- I have an Equals method that is failing due to the order and don't want to implement additional code to handle the out of order names, and
- The order really should be maintained for purposes of "top billing" where the primary or most well known cast members appear first. Obviously this would not be done on the Cast or the Movie table, and I don't think I have ever heard of anyone ever having an Identity or Sequence column on a relational table.
So I am wondering:
- Why are they not returning back to me in the order inserted
- Is my only solution to add an additional column on the relational table (whether it is a rank value or identity column and do a sort)