V
V
Vladimir2018-03-24 12:22:26
Database design
Vladimir, 2018-03-24 12:22:26

Should I merge small similar tables into one?

Good day! There are several tables with static data that can sometimes be added or deleted:

client_status - (VIP, Premium, Обычный)
time_units - (раб. дней, часов, минут)
competence - (Подготовка ТЗ, Дизайн, Печать)
task_status - (1: Active; 2: Pending)

I want to transfer all these data and tables into one common one, for example setting. This table can store some data such as the name of the site or company, work schedule, etc. The structure of this table is:
Settings:
---------
id (int 11)
key (varchar 50)
text (text)

But if I transfer all this data, then I will expand the table with one more field. I think to assign this field "type (int 11)" and write a comment like (1: client_status; 2: time_units; 3: competence; 4: task_status;)
And for example, in the "task" table in the "status" field, set the value "1 ". And already the display on the front will pull the value from the "setting" table where "type = 4 AND key = 1", and the value will be "Active" accordingly. Or make some other possible intermediate table for some data.
Like that one. What do you recommend? Do this or not invent anything and for this just create separate tables for each entity and also a couple of intermediate ones? In a word, I am looking for the help of a professional who knows how to do the right thing in such cases.
Thanks in advance for the replies!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question