Questions
IDBF001 Tutorial Quiz 7 |LA007 - Requires Respondus LockDown Browser
Single choice
Candy Database Candy ( CandyType char(15), Cost dec(9,2), Colour char(10)) People ( PersonName char(20), Age smallint, Suburb char(20), PhoneNumber char(10)) Likes ( PersonName char(20), CandyType char(15)) Choose the SQL query that will answer the following question using the Candy Database. Write a report to show the person's name and the cost of the candy they like to buy. Only include blue, red and green candy in the report.
Options
A.Select PersonName, cost
From Candy C, Likes L
Where C.CandyType = L.CandyType
And Colour in ('Blue','Red','Green')
Order by PersonName;
B.Select PersonName, costs
From Candy C, Likes L
Where C.CandyType = L.CandyType
Order by PersonName
and Colour in ('Blue','Red','Green');
C.Select PersonName, cost
From Candy C, Likes L
Where C.CandyType = L.CandyType
And (Colour = 'Blue' or 'Red' or 'Green')
Order by Cost;
D.Select PersonName, cost
From Candy C, Likes L
Where C.CandyType = L.CandyType
And (Colour = 'Blue' or 'Red' or 'Green')
Order by PersonName;
View Explanation
Verified Answer
Please login to view
Step-by-Step Analysis
We start by restating the task: write a report showing each person’s name and the cost of the candy they like to buy, but only for blue, red, and green candy.
Option 1:
Select PersonName, cost
From Candy C, Likes L
Where C.CandyType = L.CandyType
And Colour in ('Blue','Red','Green')
Order by PersonName;
This query correctly joins Candy and Likes on the CandyType column, filters by Colour to only Blue, Red, or Green, and orders the result by PersonName. The projection matches: PersonName and cost. It uses a straightforward implicit join, w......Login to view full explanationLog in for full answers
We've collected over 50,000 authentic exam questions and detailed explanations from around the globe. Log in now and get instant access to the answers!
Similar Questions
Two tables may be joined:
Question at position 51 We can calculate the cumulative sum for each date using the following SQL statement: SELECT t1.date, t1.precip AS 'daily precip', SUM(t2.precip) AS 'cum. precip' FROM rainfall AS t1 INNER JOIN rainfall AS t2 ON t2.date >= t1.date GROUP BY t1.date ORDER BY t1.date;TrueFalse
Question at position 57 We can calculate the cumulative sum for each date using the following SQL statement: SELECT t1.date, t1.precip AS 'daily precip', SUM(t2.precip) AS 'cum. precip' FROM rainfall AS t1 INNER JOIN rainfall AS t2 ON t2.date >= t1.date GROUP BY t1.date ORDER BY t1.date;TrueFalse
Question at position 57 We can calculate the cumulative sum for each date using the following SQL statement: SELECT t1.date, t1.precip AS 'daily precip', SUM(t2.precip) AS 'cum. precip' FROM rainfall AS t1 INNER JOIN rainfall AS t2 ON t2.date >= t1.date GROUP BY t1.date ORDER BY t1.date;TrueFalse
More Practical Tools for Students Powered by AI Study Helper
Making Your Study Simpler
Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!