请问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.
请问SQL代码中处理相同问题时为什么嵌套子查询时不需要分类,使用联结表的时候确需要分类呢?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
4条回答 默认 最新
- 喝茶品人生 2023-07-21 14:32关注
跟语句执行有关系,套子查询时,子查询的结果会作为外层查询的一个条件进行筛选,你当然不需要对结果进行分类。join查询时,需要将两个或多个表中的数据进行合并,所以需要对表进行分类以便进行合并。
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用
悬赏问题
- ¥20 想写一个文件管理器,加载全部子文件夹后,要一级一级返回
- ¥15 华为超融合部署环境下RedHat虚拟机分区扩容问题
- ¥15 哪位能做百度地图导航触点播报?
- ¥15 请问GPT语言模型怎么训练?
- ¥15 已知平面坐标系(非直角坐标系)内三个点的坐标,反求两坐标轴的夹角
- ¥15 webots有问题,无响应
- ¥15 使用VH6501干扰RTR位,CANoe上显示的错误帧不足32个就进入bus off快慢恢复,为什么?
- ¥15 大智慧怎么编写一个选股程序
- ¥100 python 调用 cgps 命令获取 实时位置信息
- ¥15 两台交换机分别是trunk接口和access接口为何无法通信,通信过程是如何?