Answer the question
In order to leave comments, you need to log in
What is the best way to make a MySQL table of products, only with a primary barcode, or with an ID for products without a barcode?
I am making a modern analogue of goodsmatrix.ru and habrahabr.ru/post/78826
I want to store goods with and without a barcode.
Barcodes are stored in a table with the Unsigned BIGINT field (it allows values from 0 to 18446744073709551615):
CREATE TABLE IF NOT EXISTS `goods_item` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`gtin` bigint(16) unsigned DEFAULT NULL, -- штрихкод
`category_id` int(10) unsigned DEFAULT NULL,
`name` varchar(120) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `gtin_UNIQUE` (`gtin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question