# Capgemini ADAPT 2022 Sprint 3 Book Rental A Solutions to Learning Outcome 3

In this post, we have tried to provide solutions to the problems of Capgemini ADAPT 2022 Book Rental A (Books Rented on Given Date, Current Month Users Details, User Details of Book Rental, Maximum Book Availed by the User, Books Availed by Most of the Users, Users Rented Neural Networks Book, Book not returned by the User, User & Rental Information, All User’s & Rental Information, Maximum Rent for the Month). These problems are from Capgemini ADAPT Program 2022. We have provided the solutions to the Problems noted below –

1. BRL3-1 Books Rented on Given Date
2. BRL3-2 Current Month Users Details
3. BRL3-3 User Details of Book Rental
4. BRL3-4 Maximum Book Availed by the User
5. BRL3-5 Books Availed by Most of the Users
6. BRL3-6 Users Rented Neural Networks Book
7. BRL3-7 Book not returned by the User
8. BRL3-8 User & Rental Information
9. BRL3-9 All User’s & Rental Information
10. BRL3-10 Maximum Rent for the Month

Note: The solutions are provided for your reference only. During the assessment, you are requested to not use any malpractices, rather than solve all the problems on your own. We do not encourage candidates to fall into any malpractice.

### Book Rental A Problem Solutions:

#### 1.BRL3-1 Books Rented on Given Date Problem Solution:

Display the books which were rented out on 20/11/2020

##### Solution:

alter session set current_schema = bookrental;

SELECT *

FROM book

WHERE book_id in (SELECT book_id

FROM book_rental

WHERE to_char(rental_start_date, ‘DD-MM-YYYY’) = ’20-11-2020′);

#### 2. BRL3-2 Current Month Users Details Problem Solution:

List the users who have availed of the books a current month.

##### Solution:

alter session set current_schema = bookrental;

SELECT *

FROM user_details

WHERE user_id in (SELECT user_id

FROM ook_rental

WHERE to_char(rental_start_date, ‘MON’)=’DEC’);

#### 3. BRL3-3 User Details of Book Rental Problem Solution:

Display all the users who have rented at least 1 book with details of the book & rental return date.

##### Solution:

alter session set current_schema = bookrental;

SELECT first_name, title, rental_end_date

FROM user_details a, book_rental b, book c

WHERE a.user_id = b.user_id(+) AND b.book_id = c.book_id;

#### 4. BRL3-4 Maximum Book Availed by the User Problem Solution:

Fetch the first_name of the user who has availed a maximum number of books for rental during the current fiscal.

##### Solution:

alter session set current_schema = bookrental;

SELECT first_name

FROM user_details

WHERE user_id = (SELECT *

FROM (SELECT user_id

FROM book_rental GROUP BY user_id

ORDER BY count(*) desc)

WHERE rownum <= 1);

#### 5. BRL3-5 Books Availed by Most of the Users Problem Solution:

Fetch the book which was availed for rent by most users.

##### Solution:

alter session set current_schema = bookrental;

SELECT * FROM book WHERE

book_id = (SELECT*FROM

(SELECT book_id

FROM book_rental

GROUP BY book_id

ORDER BY count(book_id) desc)

WHERE rownum <= 1);

#### 6. BRL3-6 Users Rented Neural Networks Book Problem Solution:

Identify the users who have opted for a book named ‘Neural Networks’.

##### Solution:

alter session set current_schema = bookrental;

SELECT * FROM user_details

WHERE user_id in(

SELECT a.user_id

FROM book_rental a, book b, user_details c

WHERE b.book_id = a.book_id

AND c.user_id = a.user_id

AND b.title = ‘Neural Networks’);

#### 7. BRL3-7 Book not returned by the User Problem Solution:

Fetch the user information who has not returned the books after the rental period.

##### Solution:

alter session set current_schema = bookrental;

SELECT * FROM user_details

WHERE user_id in (SELECT user_id

FROM book_rental

WHERE isreturned = ‘no’ );

#### 8. BRL3-8 User & Rental Information Problem Solution:

Display the user’s first_name, book title, and the rental end date of the book for the rental id/s which was rented on 25th Nov 2020.

##### Solution:

alter session set current_schema = bookrental;

SELECT ud.first_name, bk.title, br.rental_end_date

FROM user_details ud, book bk, book_rental br

WHERE ud.user_id = br.user_id

AND br.book_id = bk.book_id

AND to_char(br.rental_start_date, ‘dd/mm/yy’) = ’25/11/20′;

#### 9. BRL3-9 All User’s & Rental Information

Display all the user’s first name, book title, rental start date, and rental end date for all users with the rental details even if they don’t avail any books for rental and sort the output on first_name.

##### Solution:

alter session set current_schema = bookrental;

SELECT ud.first_name, bk.title, br.rental_start_date, br.rental_end_date

FROM user_details ud, book bk, book_rental br

WHERE ud.user_id = br.user_id(+)

AND br.book_id = bk.book_id(+)

ORDER BY ud.first_name;

#### 10. BRL3-10-Maximum Rent for the Month Problem Solution:

Display first name, city, and total rent amount of the month for the user whose rental amount is maximum for the month.

##### Solution:

alter session set current_schema = bookrental;

SELECT *

FROM (SELECT first_name, city, SUM(total_amount)

FROM book_rental be, user_details ud

WHERE br.user_id = ud.user_id AND br.rental_start_date like ‘%DEC%’

GROUP BY ud.first_name, ud.city

ORDER BY SUM(total_amount) desc)

WHERE rownum = 1;

### Top Companies + Batchwise Hiring Drive:

 TOP COMPANIES HIRING DRIVE BATCHWISE HIRING DRIVES

### Capgemini ADAPT Sprint 1 (Bus Reservation Solutions):

• 1. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerInAscendingOrder Problem Solution
• 2. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerByFirstName Problem Solution
• 3. Capgemini ADAPT Sprint 1 Bus Reservation System – SortByCustomerId Problem Solution
• 4. Capgemini ADAPT Sprint 1 Solution Java | LSAByCustomerName Problem Solution
• 5. Capgemini ADAPT Sprint 1 Case Study Solution Java | BSAByCustomerId Problem Solution

### Capgemini ADAPT Sprint 2 (Bus Reservation System):

• 1. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution | HAS-A-Relationship Solution Java
• 2. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution OOPs-Para-Constructor Java
• 3. Capgemini ADAPT Sprint 2 Bus Reservation System (CRUDOperations) Problem Solution

### Online Shopping A Solutions Using Java:

• 1. Capgemini ADAPT 2022 Online Shopping A – Display Products Solution using JAVA – Click Here
• 2. Capgemini ADAPT 2022 Online Shopping A – Products by Category Solution using JAVA – Click Here
• 3. Capgemini ADAPT 2022 Online Shopping A – Customer Array Solution using JAVA – Click Here
• 4. Capgemini ADAPT 2022 Online Shopping A – Search Customers by Name Solution using JAVA – Click Here
• 5. Capgemini ADAPT 2022 Online Shopping A – Search Customers by City Solution using JAVA – Click Here