J
J
jazzus2019-03-15 04:19:38
Database design
jazzus, 2019-03-15 04:19:38

Whether to do 5 tables on 2-4 records in everyone?

Purpose
Add to the model 5 fields that will be its characteristics.
Type: Color: red, green, blue.
To then filter objects according to these characteristics. Selected green and returned green objects.
Option 1:
Add the colors field to the model table. Then create another Colors table. Where to add colors. When saving the object to the model, write to the table in the colors id field of the colors.
And such 5 tables.
Option two:
Also create a colors field and write id into it. But the names of colors with their IDs should not be stored in a table, but in some php repository class in constants and get them from a file.
And such 5 files.
Which option to choose? Is it worth it to create 5 tables with 2-4 records, which then will almost never be updated?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Nesmeyanov, 2019-03-15
@jazzus

For characteristics, there is EAV

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question