Answer the question
In order to leave comments, you need to log in
Is it correct to store JSON data in MySql, in the place where heaps of tables are created?
There are users (about 200), and the Portfolio page, which displays 10 tables, all tables have a different number of columns, rows can be changed (added/deleted) by the users themselves.
That is, each user has his own portfolio and, accordingly, his own data in the table.
There are 3 storage options:
Answer the question
In order to leave comments, you need to log in
This is a classic relational structure. Why does it all need to be stored in json?
Read normal forms for RDB. Connections. Briefly - tables should contain separate meaningful units of information in separate fields, if these information blocks refer to different entities - these should be different tables. Relationships between entities are correlated through identifier keys. There is ideally no duplication of information in tables, that is, if table A has a value a that can be associated with table B, this value is not recorded in B, but a link is created through a key with table A, or if there can be many such links - a separate table of relationships is created (one-to-many or many-to-many).
You can, of course, only there is one problem - checking the validity of the data before writing it to MySQL. Out of the box, MySQL does not have built-in schema validators. I wrote such a check in Java / JavaScript / Nashorn (so that the same function validates JSON on exit from the page and on entry to the servlet) before saving.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question