一道001关于sort的疑问

[复制链接]
查看11 | 回复3 | 2005-2-28 12:57:00 | 显示全部楼层 |阅读模式
You want to display inventory id numbers and their descriptions with these desired results:
1. The price of the item must be 8.25 or .25.
2. The display must be sorted alphabetically by the item description.
3. The items must have been ordered prior to June 10, 1997.

Evaluate this SQL script:
SELECT id_number, description
FROM
inventory
WHERE price IN (8.25, 0.25)
ORDER BYdescription desc;
What does the proposed solution provide?
a.
one of the desired results
b.
two of the desired results
c.
all of the desired results
d.
no results because the statement will not execute
为什么答案是A, 难道The display must be sorted alphabetically by the item description.不满足吗?

回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
答案是A。因为只满足了PRICE IN(8。25,0。25),如果在ORDER BY中没有DESC,那就满足了B。 ORDER BY col_name ASC=ORDER BY col_name,result is sorted alphabetically by the item description.
回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
这题真怪,也就是说降序排列就不叫按字母排列,好象有点白马非马论
回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
按字母顺序排列就是缺省的由小到大,这是老外的逻辑,如果是由大到小的话,他肯定会明确说明的,所以不能用中国人的思维去思考,赫赫。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行