> Just a quick question on whether I need both fields to > be indexed. > > The table is as below.. I'm wondering if I need to have these > 2 fields -> > fa_id & serial_no > > fa_id would be a 7 character int like "0000001", "0000002" > serial_no would be like "WMACK0000001", "WMACM0000121" > > most of the time, we'll be referencing the serial_no more as > it's what's > being used most often in my nature of work. Initially I > thought that I could > index or make serial_no my primary key but as it's not fully > numeric, I'm > not sure if this is advisable. >
There is nothing wrong with a non-numeric primary key. A string search/comparison might be marginally slower than a numeric search but there shouldn't be much difference. Depending on the size of you database, there may be storage implications if you need to have the serial_no as a foreign key in lots of places. > Can anyone help me out? Do I need the fa_id field? If I were > to use mysql to > query for data, most likely I'll be using the Serial_no as > the reference and > not fa_id. I would say you don't need it. Some people like to put a surrogate key on everything, but if you have a natural key why not use it. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]