RenJie_Li 2023-07-21 14:14 采纳率: 100%
浏览 30
已结题

请问SQL代码中处理相同问题时为什么嵌套子查询时不需要分类,使用联结表的时候确需要分类呢?

img

请问SQL代码中处理相同问题时为什么嵌套子查询时不需要分类,使用联结表的时候确需要分类呢?
问题:Let’s make the previous challenge more useful. In addition to returning the customer name and order number, add a third column named OrderTotal containing the total price of each order. There are two ways to do this, you can create the OrderTotal column using a subquery on the OrderItems table, or you can join the OrderItems table to the existing tables and use an aggregate function. Here’s a hint, watch out for where you need to use fully qualified column names.

  • 写回答

4条回答 默认 最新

  • Watch the clown 2023-07-21 14:32
    关注

    跟语句执行有关系,套子查询时,子查询的结果会作为外层查询的一个条件进行筛选,你当然不需要对结果进行分类。join查询时,需要将两个或多个表中的数据进行合并,所以需要对表进行分类以便进行合并。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 7月29日
  • 已采纳回答 7月21日
  • 创建了问题 7月21日