一、原题
View the Exhibit and examine the data in the PROMO_CATEGORY and PROMO_COST columns of the PROMOTIONS table.

Evaluate the following two queries:
SQL>SELECT DISTINCT promo_category to_char(promo_cost)"code"
FROM promotions ORDER BY code;
SQL>SELECT DISTINCT promo_category promo_cost "code"
FROM promotions ORDER BY 1;
Which statement is true regarding the execution of the above queries?
A. Only the first query executes successfully.
B. Only the second query exe
Evaluate the following two queries:
SQL>SELECT DISTINCT promo_category to_char(promo_cost)"code"
FROM promotions ORDER BY code;
SQL>SELECT DISTINCT promo_category promo_cost "code"
FROM promotions ORDER BY 1;
Which statement is true regarding the execution of the above queries?
A. Only the first query executes successfully.
B. Only the second query exe

本文探讨了在Oracle SQL查询中使用ORDER BY子句与列别名时的注意事项。通过示例展示了当别名引用不正确时会导致查询失败,而使用数字索引可以正确执行排序。重点讲解了ORDER BY在处理别名时需完全匹配,包括双引号的使用。
最低0.47元/天 解锁文章
195

被折叠的 条评论
为什么被折叠?



