I am working on an inventory system for my company. Each item in our inventory has a unique certification number. However, this certification number can and does commonly change while it moves through the system from purchase to evaluation to sale. Because the certification number can change, I use an item_id field that's just an auto incrementing integer as the primary key so that I can reference that in other tables and not have to update the other tables if/when the certification number changes.
How do I make it so that I can also make the certification field require a unique value? Is there a way to do an insert query that is something like "on duplicate key update cost = '$cost'" but would check the certification field instead of the key for that duplication? Do I just make it as the 2nd key in the table?
Thanks for your time everyone.