Capgemini Adapt 2022 – Toy Rental A Learning Outcome 3 Solutions

The problems of  Toy Rental LO 3 are – Toys based on Rental Date, Max Rental for the Month, Toys based on Rental Count, Toys and Customer Details, Max Toys by Customer, Max Rental of Toys by Customer, Toys Minimum of two, Pending Rental Status, Customer and Toys.

In this post, you will get the solution to the Capgemini ADAPT 2022 solutions to the problems of Toy Rental A Learning Outcome 3.

Note: The solutions are provided for learning purposes only.

Toy Rental A – SQL Problem Solutions – Learning Outcome 3:

1. Toys based on Rental Date:

alter session set current_schema = mt_toy;

SELECT * FROM TOY_RENTAL
WHERE TO_CHAR(RENTAL_START_DATE, ‘DD-MM-YY’) = ’20-05-20′;

2. Max Rental for the Month:

alter session set current_schema = mt_toy;

SELECT * FROM
(SELECT TO_CHAR(RENTAL_START_DATE, ‘Month’), COUNT(TOY_ID) AS TOTAL_TOYS
FROM TOY_RENTAL
GROUP BY TO_CHAR(RENTAL_START_DATE, ‘Month’)
ORDER BY TOTAL_TOYS DESC)
WHERE ROWNUM = 1;

3. Toys based on Rental Count:

alter session set current_schema = mt_toy;

SELECT CUSTOMER_NAME, TOY_NAME, RENTAL_END_DATE
FROM CUSTOMER C, TOY T, TOY_RENTAL R
WHERE C.CUSTOMER_ID = R.CUSTOMER_ID(+)
AND R.TOY_ID = T.TOY_ID;

4. Toys and Customer Details:

alter session set current_schema = mt_toy;

SELECT CUSTOMER_NAME, TOY_NAME, RENTAL_END_DATE
FROM CUSTOMER C, TOY T, TOY_RENTAL R
WHERE C.CUSTOMER_ID = R.CUSTOMER_ID(+)
AND R.TOY_ID = T.TOY_ID;

5. Max Toys by Customer:

alter session set current_schema = mt_toy;

SELECT DISTINCT CUSTOMER_ID FROM TOY_RENTAL
JOIN TOY
ON TOY_RENTAL.TOY_ID = TOY.TOY_ID
WHERE CUSTOMER_ID = 1010;

6. Max Rental of Toys by Customer:

alter session set current_schema = mt_toy;

SELECT T.TOY_ID, TOY_NAME, TOY_TYPE, MIN_AGE, MAX_AGE, PRICE, QUANTITY, RENTAL_AMOUNT
FROM TOY T, CUSTOMER C, TOY_RENTAL R
WHERE C.CUSTOMER_ID = R.CUSTOMER_ID AND T.TOY_ID = T.TOY_ID
AND T.TOY_ID = 5208 OR T.TOY_ID = 5203
GROUP BY RENTAL_AMOUNT, T.TOY_ID, TOY_NAME, TOY_TYPE, MIN_AGE, MAX_AGE, PRICE, QUANTITY;

7. Toys Minimum of Two:

alter session set current_schema = mt_toy;

SELECT * FROM CUSTOMER
WHERE CUSTOMER_ID IN(SELECT CUSTOMER_ID FROM TOY_RENTAL
WHERE RENTAL_START_DATE < SYSDATE
GROUP BY CUSTOMER_ID
HAVING(COUNT(CUSTOMER_ID) > 1));

8. Pending Rental Status:

alter session set current_schema = mt_toy;

SELECT * FROM CUSTOMER
WHERE CUSTOMER_ID IN(SELECT CUSTOMER_ID FROM TOY_RENTAL
WHERE RENTAL_END_DATE < TO_CHAR(SYSDATE, ‘DD-Mon-YY’)
AND STATUS = ‘Pending’
GROUP BY CUSTOMER_ID);

9. Customer and Toys:

alter session set current_schema = mt_toy;

SELECT CUSTOMER_NAME, CITY, RENTAL_ID, RENTAL_START_DATE, RENTAL_END_DATE
FROM CUSTOMER C, TOY_RENTAL R
WHERE C.CUSTOMER_ID = R.CUSTOMER_ID(+);

10. Details of Toy, Customer:

alter session set current_schema = mt_toy;

SELECT CUSTOMER_NAME, TOY_NAME, RENTAL_START_DATE, RENTAL_END_DATE
FROM CUSTOMER C, TOY T, TOY_RENTAL R
WHERE TO_CHAR(RENTAL_START_DATE, ‘DD-MM-YY’) = ’25-01-20′
AND C.CUSTOMER_ID = R.CUSTOMER_ID
AND R.TOY_ID = T.TOY_ID;

Top Companies + Batchwise Hiring Drive:

 TOP COMPANIES HIRING DRIVE BATCHWISE HIRING DRIVES

ADAPT Different Coding Solutions:

1. Largest Array Solution – Click Here
2. Batsman & Bowler Solution – Click Here
3. Instruments Problem Solution – Click Here
4. Check Two Person Are Same – Click Here
7. Remove”X”inString Problem Solution – Click Here
8. Customer and Invoice ADAPT Problem Solution – Click Here
9. Book and Author Problem Solution – Click Here
10. Highest Feedback Problem Solution – Click Here
11. Registered Customer Problem Solution in Java – Click Here
12. Product of Digits Problem Solution – Click Here
13. Change Using Minimal Coins/Notes Solution in Java – Click Here