Question: Write a SQL query to find the top - rated book titles along with their authors. Consider only books with reviews, and for each book,

Write a SQL query to find the top- rated book titles along with their authors. Consider only books with reviews, and for each book, calculate the average rating of the books that are published in the same year (including the book itself). Return the book title, author name, and the calculated average rating. Sort the results in descending order by the average rating.
Tables Schema as Below:
authors
columnName dataType
id INT
name VARCHAR(255)
birth_year INT
death_year INT
book
columnName dataType
id INT
author_id INT
title VARCHAR(255)
publish_year INT
publishing_house VARCHAR(255)
rating DECIMAL(3,2)
book_review
columnName dataType
book_id INT
review TEXT
author VARCHAR(255)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!