Using the books table, create a simple recommendation system.
Given the book with book_id = 20039, suggest other books that:
- have the same
publisher
- have a
book_name containing the string PostgreSQL
Exclude the starting book, sort by book_id, and return only 5 rows.
Hints
-
Hint 1
First, retrieve the publisher of the book with book_id = 20039.
You can do this with a subquery or a CTE.
-
Hint 2
In the main query, look for books with the same publisher.
Also, book_name must contain PostgreSQL.
-
Hint 3
Do not include the starting book.
Order by book_id and use LIMIT 5.