Question: Generating two SQL queries for specified tasks: For my assignment, I need to generate and test two SQL queries for each of the following tasks:

Generating two SQL queries for specified tasks:

For my assignment, I need to generate and test two SQL queries for each of the following tasks: a) the SQL statement needed to perform the stated task with the traditional approach, and b) the SQL statement needed to perform the stated task with the JOIN keyword. Also, I need to apply table aliases in all queries. I can get the program to output the correct value, however, it outputs duplicates, which I am unsure why it is doing so. I believe that the program should not be outputting duplicates. Can you help me understand how to fix this? Thanks!

Question: What gift will a customer who orders the book Shortest Poems receive? Use the actual book retail value to determine the gift.

What I have:

Part A) SELECT b. title, p.gift FROM books b, promotion p WHERE b.retail BETWEEN p.minretail AND p.maxretail AND b.title = 'SHORTEST POEMS';

Part B) SELECT b.title, p.gift FROM books b JOIN promotion p ON b.retail BETWEEN p.minretail AND p.maxretail WHERE b.title = 'SHORTEST POEMS';

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!