Are product box bar codes suitable for primary keys?

2

Situation

In a system where the products will be stored in the database, and the bar code is a single field, I would like to know if the bar codes that come in the boxes of products have the possibility of repeating with different products. The company works with network equipment, there is an alternative to identify the products through MAC, however they also work with some products that do not have MAC.

Summarizing

I do not know anything about bar codes and the possibility of them repeating.

    
asked by anonymous 04.04.2016 / 05:39

2 answers

2
  

Bar codes for product boxes are suitable for keys   primary?

Answering the question, no, it is never good to make public the identifier of a bank record. Public information, even if they are unique as a bar code, are usually only associated with UNIQUE constraints in the database that have other IDs generated internally.

    
31.08.2016 / 21:12
1

Not even, primary key has to be unique okay, that's right, but being an information that the user can mess up puts your entire table at risk. In addition to being more optimized if it is of numeric type, which it would not be able to do using bar code.

    
31.08.2016 / 21:24