TASK #127 · Hard · CianUser last 3 borrowed works and total times taken
Your brief
In the library system, the OperationLogs table records book borrowing and return operations.
Each record contains information about which user took which book copy and when.
For each user, find their last three borrowings; if a user borrowed the same work more than once, it may appear several times. For each of those works, indicate the user (user_id), the work title (book_title) and how many times it was borrowed in total (by all users throughout history) (total_times_taken).
For each user, find their last three borrowings; if a user borrowed the same work more than once, it may appear several times. For each of those works, indicate the user (user_id), the work title (book_title) and how many times it was borrowed in total (by all users throughout history) (total_times_taken).
Ctrl / ⌘ + ↵
Result
Write a query and run it to see the results.
Schema
Booksid, titleBookEditionsid, book_id, publish_year, pagesBookCopiesid, edition_id, inventory_numberOperationLogsid, user_id, copy_id, date_taken, date_returned