Soru
Q1-Asswer the following questions by writing an SOL statement using the tables below. (21 points) , frame, dob, dop,addren, city) book (isny, title, no of pages, publisher writer) reservationirsectration M, date out, date a) Display finst name lant name and address of all guests whose city is same as Alex Ball (7 points) SELECT fname , Iname , address FR OM guest WHERE city='Alex Bald' b) Display the guests fname, Iname and the name of the book they took out. (7 points) c) Display the number of books each guest tock out in lotal (7 points)
Çözüm
4.1
(300 Oylar)
Yaşar
Profesyonel · 6 yıl öğretmeni
Uzman doğrulaması
Cevap
a) Display first name, last name, and address of all guests whose city is same as Alex Ball.```sqlSELECT fname, lname, addressFROM guestWHERE city = 'Alex Ball';```b) Display the guests' first name, last name, and the name of the book they took out.```sqlSELECT g.fname, g.lname, b.titleFROM guest gJOIN book b ON g.addren = b.writer;```c) Display the number of books each guest took out in total.```sqlSELECT g.fname, g.lname, SUM(b.no_of_pages) as total_pagesFROM guest gJOIN book b ON g.addren = b.writerGROUP BY g.fname, g.lname;```