Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

View Book Request by Certain Customer - mysql Customer table: Book_request table

ID: 3919572 • Letter: V

Question

View Book Request by Certain Customer - mysql

Customer table:

Book_request table:

Customer_has_book_request table:

FINES_idFINES idCUSTOMER 123456789012345 Johnnv Rock1949-10-20 iohnr @mail.com 151595254105418 298765432123456 Waters 1999-04-23 lolawaters@mail.com 56 Red St. Baltimore MD 414392845733378 Joe 488806912544440 512651122522845 RachelSac FName LName DOB Email Address 22 Yellow Ct. Hvattsville MDULL NULL NULL 74446382 Julia inoot2929@mail.com 2 Purole Rd. Baltimore MD 35 Pink St. Eldersbura MD 726 Green Rd. Eldersbura MD Noot1989-03-10 1980-04-25 iomev14@mail.com Mever Mason1994-11-12 Alexis alexmavvv09@mail.com10 Red Ave. Baltimore MD NULL 1959-05-14 rsac837@mail.com 98371920

Explanation / Answer

I think the code is self understood but i would like to explain what i am doing. I am printing FName, LName, DOB, Title & Cost from Book_request and Customer table. I am first doing inner join on Book_request table and Customer_has_book_request table based ib book request id so that i get the customers who actually booked the book. Once i get this result i am doing inner join of the previous result on the Customer table to get the details of the customer.

Code:

SELECT FName, LName, DOB, Title, Cost from Book_request br inner join Customer_has_book_request chbr on
br.idBOOK_REQUEST = chbr.BOOK_REQUEST_idBOOK_REQUEST inner join Customer cst on
cst.idCUSTOMER = chbr.CUSTOMER_idCUSTOMER;