tags:

views:

42

answers:

2

I have a database full of band names.

Many of these start with "The" (eg "The Strokes").

Should I split out the "The" portion into its own DB field or keep it all as one name and handle "The" sorting/searching with SQL?

Originally I had split out "The" from the beginning of the band names and put it in a boolean flag field.

I did this so that searches and browse lists could be easily run without them being ordered by "The" or having searches not show when "The" is omitted in the user query.

This would seem to be a common occurrence, but I'm not sure what the "best practice" route is here.

+1  A: 

Keep a separate column for BandSortName and populate that at insert.

Joel Coehoorn
A: 

I'm sure there's a standard but it's an English language usage one, not a programming one.

If you decide to implement that standard, one method of handling this is to have two fields in the database, the official, displayed name and the one used for sorting. This can handle a variety of unforeseen cases with a minimum of user input (assuming your UI copies the displayed name into the sort name on entry) at the expense of disk storage.

Larry Lustig