The problem with the table "Products". The problem is that there should be repetitive indexes. But the trouble is that the field is key. Naturally repetitions are not allowed, but in fact this field should be key, because it has dependencies. Is it necessary to introduce additional entity? I would like to solve it without it, and there are enough tables

enter image description here

  • Do you mean that the product code is not unique? - default locale
  • I did not understand something, you want to say that product codes can repeat there, but if we have two products with the code 'ABC', then how do we understand the entries in the table, for example, the “composition of the product” does not refer to the first product with the code ' ABC 'or second? - Mike
  • @defaultlocale locale Just once he is unique, the problem is that it will be necessary to make a sample: For example, the number of units issued of a particular type per month, and if there is only one unique record in the table, then there is no use with the selection - Abraham
  • maybe you are doing something wrong? an additional table is suggested which will be for the product, in this case the product reference will have unique values ​​and what you need in the product. Well, this is the solution to the forehead - Bald
  • @Mike, the code is unique, the composition of the product refers to only one product - Abraham

1 answer 1

Of course, you need to enter an additional entity if you want to use the Product ID as the primary key.

An alternative would be to create a composite primary key, but in my opinion, this is not correct, based on your last comment.

It is better to still create a separate entity that will store in itself the total of the Product Code and the Date of Manufacture. Then, if necessary, you can always collect statistics.

PS

1) According to the rules of good tone, the name of the fields and entities is better to use English

2) "Tables so many" ... Many tables do not exist. 7 tables are not enough, I had 20 tables.

  • Again, if the table contains a code and a date, then again there will be a key on one of the fields, purely logical dates can coincide, and if you put a key field, then all is Abraham
  • @Abraham key field can consist of several table fields - this is called a complex (composite) key - Bald