暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

等值连接

淮海路小佩奇 2023-08-26
112

在等值连接中,该结果同时包括 manufact 和 stock 表中的 manu_code 列,原因是选择列表

请求每个列。

还可以使用附加约束创建等值连接,此时比较条件基于连接列中值的不相等性。这些连接

在 WHERE 子句中指定的比较条件中除等号(

=)之外还使用其他关系运算符。

要连接包含相同名称的列的表,用列的表名和句点(

.)限定每个列名,如下列查询所示。

图: 查询

SELECT order_num, order_date, ship_date, cust_calls.*

FROM orders, cust_calls

WHERE call_dtime >= ship_date

AND cust_calls.customer_num = orders.customer_num

ORDER BY orders.customer_num;

该查询连接 customer_num 列,然后只选择 cust_calls 表中 call_dtime 大于或等于 orders 表中

的 ship_date 那些行。该结果显示它返回的组合行。

order_num 1004

order_date 05/22/1998

ship_date 05/30/1998

customer_num 106 GBase 8s SQL 指南:教程

南大通用数据技术股份有限公司

61

call_dtime 1998-06-12 08:20

user_id maryj

call_code D

call_descr Order received okay, but two of the cans of

ANZ tennis balls within the case were empty

res_dtime 1998-06-12 08:25

res_descr Authorized credit for two cans to customer,

issued apology. Called ANZ buyer to report

the qa problem.

order_num 1008

order_date 06/07/1998

ship_date 07/06/1998

customer_num 110

call_dtime 1998-07-07 10:24

user_id richc

call_code L

call_descr Order placed one month ago (6/7) not received.

res_dtime 1998-07-07 10:30

res_descr Checked with shipping (Ed Smith). Order out

yesterday-was waiting for goods from ANZ.

Next time will call with delay if necessary.

order_num 1023

order_date 07/24/1998

ship_date 07/30/1998

customer_num 127

call_dtime 1998-07-31 14:30

user_id maryj

call_code I

call_descr Received Hero watches (item # 304) instead

of ANZ watches

res_dtime

res_descr Sent memo to shipping to send ANZ item 304

to customer and pickup HRO watches. Should

be done tomorrow, 8/1 

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论