Given the following relations: Publisher Printer a) Using SELECT, PROJECT, and J
ID: 3556821 • Letter: G
Question
Given the following relations:
Publisher
Printer
a) Using SELECT, PROJECT, and JOIN, write code to find the printers who
can supply books with a rating over 4.3.
Ex Answer..
TEMP1 <- SELECT from PRINTER
TEMP2 <- JOIN TEMP1
TEMP3 <- JOIN TEMP2 (IF NEEDED)
RESULT <- PROJECT Name, Title from TEMP3
b) Explain clearly what question is answered by the following code.
TEMP1 ? SELECT from Printer
where Cost < 5.00
TEMP2 ? JOIN TEMP1 and Publisher
where TEMP1.ISBN = Publisher.ISBN
RESULT ? PROJECT Title from TEMP2
c) What are the results of this database query?
Madame Bovary Flaubert 427 4.0
Explanation / Answer
1.
temp1 <-- select from publisher
where publisher.rating >4.3
temp2 <-- join printer
where printer.ISBN = publisher.ISBN )
Result <--project printer from temp2
2.
TEMP1 ? SELECT from Printer
where Cost < 5.00
TEMP2 ? JOIN TEMP1 and Publisher
where TEMP1.ISBN = Publisher.ISBN
RESULT ? PROJECT Title from TEMP2
Ans :
This will find all the title from the publisher whose printer cost is less than 5
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.