There are tables: book (id, title) tag (id, tag) bind_book_tag (id_book, id_tag)
The first is for books, the second is for tags, the third is for bundles of tags and books (by id, that is, in one row in the id_book column, the book id is specified from the book table and the id_tag column is the tag id from the tag table). Each book has several tags. The id of each book is associated with the id of the desired tag in a separate line in the bind_book_tag table.
How for one book to pull out relevant (similar) books by tags? You can multiple requests. Application on php.