C
C
celovec2020-04-15 14:23:20
MySQL
celovec, 2020-04-15 14:23:20

Mysql store everything in 1 table or several?

There are many small blocks on the site (phone numbers, partners, address, working hours, social links, etc.) that are edited separately and saved to the database as separate entries.
That is, there is a table 'singl' with fields singl: (int 100), content: (varchar 500) there are about 50 such small blocks.
And there is a table 'pages' with fields pages: (int 100), content: (varchar 3000) where the content is stored - the long text of the page. There are about 30 such pages.
It turns out that when we open a page of the site, we make a selection in two tables, in the 'articul' and 'pages' fields.
The question is, does it make sense to divide into 2 tables, can everything be stored in one?
Which option is more correct in your opinion?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mayton2019, 2020-04-15
@mayton2019

Yes, you can merge 2 tables into one.
This is called denormalization.
All methods are correct in their own way. But the format of the message is not enough for the development of this thought. Roughly speaking. If your data is not updated. And there will be no update anomalies. Then calmly store everything in 1 table.

A
Alexandra, 2020-04-16
@AK74U

If the project is small ("one-time"), you will not experience much inconvenience by storing in one table. But if it starts to develop, you can later regret the denormalized solution.
If to approach abstractly - to store in one incorrectly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question