Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions