I will speak about the technical first step where I needed to solve questions in Python for half an hour and in SQL for half an hour. I succeeded in solving 2 SQL questions and 1 in Python.
SQL Part:
- I was given 5 tables representing a library. The main 2 and only tables I needed to use in the following questions were: copies and checkouts.
- Copies table: book_id, copy_id, condition.
- Checkouts table: copy_id, checkout_date, returned_date, renewed_count.
- First question: Calculate the total number of books whose condition is good and that haven't been returned yet, which should be called "numbers_of_returned_books". Take this total and return the percentage of books whose renewed count is greater than 2, which should be called "pct_renewed". The output should be numbers_of_returned_books and pct_renewed.
- Second question: They defined a value called lifetime_value. This value is calculated as the number of days since the day they were taken and returned. I was asked to retrieve the book IDs whose lifetime value is in the top 3 books, paying attention that their number of copies is less than or equal to 10 and their returned_date is not null.
Python Part:
You are given a books list that contains tuples. Each book in the books list contains the book name and its score. For example, the list of books is [("Agr", 3), ("bsa", 2), ("Agr", 4), ("mas", 7)]. You need to return the highest score sum given to the top 3 books in the list. You are not allowed to sum the score number for a book twice.