K
K
Karl Meinhoff2016-02-01 11:41:09
PHP
Karl Meinhoff, 2016-02-01 11:41:09

What is the best way to store book tags in mySQL?

I am writing a library website. There was a need to store tags in a MySQL table (books are stored in this table). The structure is: klatz . There was an idea to store the tags for the book in the tags field as JSON, specifically like this:

{
    "tags": [
        // [тут теги]
    ]
}

But the problem is that there should be a search for these tags. Therefore, this option seems unacceptable to me. Tell me, how best to store them (tags)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zhainar, 2016-02-01
@KarleKremen

in a separate table and another table of tag relationships to books.

D
Dmitry Entelis, 2016-02-01
@DmitriyEntelis

You should always start with third normal form.
Any denormalization, etc., is done later and separately, when there is an understanding of the tasks and bottlenecks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question