M
M
Max Khrichtchatyi2014-02-05 06:51:37
MySQL
Max Khrichtchatyi, 2014-02-05 06:51:37

What is the best way to store a large list of parameters in MySQL? Structure design

There are many elements, for example "cars" and each element has a large number of different parameters, for example: truck, new, repair, automatic, left-hand drive, etc...
Previously, we stored everything like this:

CREATE TABLE IF NOT EXISTS `example` (
  `id_car` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `a` tinyint(1) unsigned NOT NULL,
  `b` tinyint(1) unsigned NOT NULL,
  `c` tinyint(1) unsigned NOT NULL,
  PRIMARY KEY (`id_car`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Now there is a task to change the structure to allow users to add new parameters - similar to how tags are added for each question in toster.ru. Could you tell me how to properly organize the appropriate structure in the database?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
enchikiben, 2014-02-05
@EnChikiben

Select these parameters in a separate table, many-to-many relationship

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question