work with an inventory, with some items having serial number

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Vegan
Forum Regular
Posts: 565
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC

work with an inventory, with some items having serial number

Post by Vegan »

I was wondering how to use MySQL to handle an inventory system, easy enough when there is a simple count of the UPC for each item

I was wondering with electronics how to handle series numbers

clearly serial numbers are not useful as an index, while UPC is slightly more suitable

ideas?
Hardcore Games™ Legendary is the Only Way to Play™
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: work with an inventory, with some items having serial nu

Post by Christopher »

I would in general recommend an autoincrement INT for indexes. The product, serial, series, etc. numbers would be separate fields that can be indexed if they are to be searched in WHERE statements.
(#10850)
User avatar
Vegan
Forum Regular
Posts: 565
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC

Re: work with an inventory, with some items having serial nu

Post by Vegan »

That is more or less what I was figuring, more rows for those items with serial numbers.

products like iphone cables do not have a serial number, unlike the iphone itself

upc codes are abundant but imperfect

I was pondering 2 tables, one for the products and a bool then for those who have serial numbers,pull the data from another table which would simplify things a tad
Hardcore Games™ Legendary is the Only Way to Play™
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: work with an inventory, with some items having serial nu

Post by Christopher »

Vegan wrote:I was pondering 2 tables, one for the products and a bool then for those who have serial numbers,pull the data from another table which would simplify things a tad
Sounds like more work if there is just 1:1 relation -- just leave the serial number field empty if there isn't one. It's not like your disk will fill up with all those serial numbers.
(#10850)
Post Reply