531. Most Borrowed Book
MediumGROUP BYORDER BY
Return the title of the book(s) borrowed the most times and the count as loans, ordered by title.
books
| id | title | author | genre | year | copies |
|---|---|---|---|---|---|
| 1 | Wings of Fire | A. P. J. Abdul Kalam | Biography | 1999 | 3 |
| 2 | The Guide | R. K. Narayan | Fiction | 1958 | 2 |
| 3 | Malgudi Days | R. K. Narayan | Fiction | 1943 | 1 |
| 4 | Discovery of India | Jawaharlal Nehru | History | 1946 | 2 |
| 5 | Gitanjali | Rabindranath Tagore | Poetry | 1910 | 1 |
| 6 | Train to Pakistan | Khushwant Singh | Fiction | 1956 | 2 |
members
| id | name | joined |
|---|---|---|
| 1 | Kavya | 2023-01-10 |
| 2 | Rahul | 2023-03-22 |
| 3 | Sneha | 2024-02-01 |
| 4 | Vikram | 2024-06-15 |
loans
| id | book_id | member_id | loan_date | return_date |
|---|---|---|---|---|
| 1 | 1 | 1 | 2024-07-01 | 2024-07-10 |
| 2 | 2 | 1 | 2024-07-05 | NULL |
| 3 | 2 | 2 | 2024-07-06 | 2024-07-20 |
| 4 | 4 | 3 | 2024-08-01 | NULL |
| 5 | 3 | 2 | 2024-08-03 | 2024-08-04 |
| 6 | 1 | 3 | 2024-08-10 | 2024-08-25 |
| 7 | 6 | 1 | 2024-09-01 | NULL |
| 8 | 1 | 2 | 2024-09-02 | NULL |
Your query runs on a fresh copy of these tables (SQLite). Column names in your result do not need to match.
Loading the MyLoginn IDE…