题目
题目

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道考试原题与详细解析,现在登录,立即获得答案。

类似问题

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!