Back to questions

SQL Tutorial Lesson: SQL Joins Goodreads Books SQL Interview Question

SQL Tutorial Lesson: SQL Joins

Goodreads Books SQL Interview Question

This question serves as a platform for you to explore into the dataset and execute your queries. Please refrain from submitting your solution for this question.

Schema:

Column NameTypeDescription
book_idintegerThe unique identifier for each book.
book_titlevarcharThe title of the book.
authorvarcharThe author(s) of the book.
genrevarcharThe genre of the book.
year_releasedintegerThe year when the book was released.
countryvarcharThe country of origin of the book.
publicationvarcharThe publisher or publication name of the book.
book_ratingdecimal (5,2)The average rating of the book (x/5).
awards_wonintegerThe number of awards won by the book.
number_of_reviewsintegerThe total number of reviews for the book.
pricedecimal (5,2)The price of the book in USD.

Example Input:

book_idbook_titleauthorgenreyear_releasedcountrypublicationbook_ratingawards_wonnumber_of_reviewsprice
1001A Gentleman in MoscowAmor TowlesHistorical Fiction2016United StatesViking4.4101020016.8
1002Ace the Data Science InterviewKevin Huo, Nick SinghNon-Fiction2021United StatesAce the Data Science Interview4.5885031
1004Atomic HabitsJames ClearSelf-Help2018United StatesAvery4.8101300014.99

Schema:

Column NameTypeDescription
order_idintegerThe unique identifier for each order.
customer_idintegerThe unique identifier for each customer.
book_idintegerThe unique identifier for each book associated with the order.
order_datedatetimeThe date and time when the order was placed.
quantityintegerThe quantity of the book ordered in this specific order.

Example Input:

order_idcustomer_idbook_idorder_datequantity
2001500110032023-01-15T10:30:00Z2
2002500210082023-02-03T14:15:00Z1
2003500110022023-02-08T09:45:00Z3

Schema:

Column NameTypeDescription
delivery_idintegerThe unique identifier for each delivery.
order_idintegerThe unique identifier of the associated order.
delivery_datedatetimeThe date and time when the delivery status was updated.
delivery_statusvarcharThe status of the delivery (e.g., Delivered, Shipped, In Progress, Pending).

Example Input:

delivery_idorder_iddelivery_datedelivery_status
300120012023-02-01T08:45:00ZDelivered
300220022023-02-02T10:20:00ZShipped
30042004In Progress
30052005Pending

Input

(PostgreSQL)

Output