Questions regarding primary keys, updates, and autoincrement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

I have been working on an e-business project and have a product table
and manufacturer table that are linked via barcode and a manufacturer ID
(both primary keys in the tables mentioned).  For now, I have been
setting the manufacturer's ID manually, primarily for that rare instance
where a manufacturer and its products are dropped from the database, but
the number should be reused.  Is it better or possible (without
complications) to use autoincrement and simply delete the product
information and manufacturer information while leaving the ID column
intact for a later update operation with a new manufacturer and its
products? I suppose only one table (the linking table?) should be set to
autoincrement and that ID number used to populate the remaining tables
depending upon that number for insert operations.  The code is probably
simple, but my head is already swimming.  I suppose what I am looking
for is "best practice" advice from seasoned db administrators.

 

A second question, which may be moot if autoincrement is the best way to
go, is why I keep getting an duplicate key error despite using IGNORE in
my mysql update scripts.  Keep in mind that the update is completed
anyway (even without using IGNORE) but the abort prevents an
acknowledgement script which is essential in unregistering sessions
crucial in future update operations.

 

Thanks.

Michael Conway

mconway3@cox.net

(703) 968-8875

 


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux