题目
IDBF001 Tutorial Quiz 7 |LA007 - Requires Respondus LockDown Browser
单项选择题
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.
选项
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;
查看解析
标准答案
Please login to view
思路分析
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 explanation登录即可查看完整答案
我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。
类似问题
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
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!