1
I have a table "likes", "commented" and "visited", each time a user likes, comments or visits a particular book on my page a record is inserted in the database for such:
Table likes:
+----------------+-------------+
| id_livro | usuario |
+----------------+-------------+
| 1 | user_id |
+----------------+-------------+
| 4 | user_id |
+----------------+-------------+
| 1 | user_id |
+----------------+-------------+
Table commented:
+----------------+-------------+
| id_livro | comentario |
+----------------+-------------+
| 1 | coment 1 |
+----------------+-------------+
| 7 | coment 2 |
+----------------+-------------+
| 1 | coment 3 |
+----------------+-------------+
Table visited:
+----------------+-------------+
| id_livro | usuario |
+----------------+-------------+
| 1 | user_id |
+----------------+-------------+
| 6 | user_id |
+----------------+-------------+
| 4 | user_id |
+----------------+-------------+
In the example above we see that the book with id 1
is repeated in the 3 tables and the book with id 4
is repeated in two of them, these in case would be 2 books that I would recommend to customers on a list because apparently are two "popular" books, as I could organize a SELECT
to return the books to me so that I can organize them on the page "recommended"
What criteria would you use to show the popular ones? By the diversity of activities? By the amount of activities? Or would limit for example to 2 recommendations?
– Sorack
If a book repeats itself in at least 2 tables it is a good book to be recommended the diversity of activities related to it is a good criterion, would be 3 books to be recommended on the page
– Leo Letto
Why 3? In your example I only see 2 meeting the criterion
– Sorack
I used as example only 2 that meet the criteria for the question not getting too extensive but I want to recommend 3 books that meet the criteria
– Leo Letto