gpt4 book ai didi

mysql - 内连接和交叉连接产生相同的结果

转载 作者:行者123 更新时间:2023-11-29 12:20:02 44 4
gpt4 key购买 nike

use classicmodels;

select Orders.OrderNumber,
Customers.CustomerName, Orders.Status, orders.shippeddate,
Customers.Country
from Customers **cross join/inner join** Orders
on Customers.CustomerNumber = Orders.customerNumber
order by 1 asc

大家好,我真的很困惑为什么查询中的内部联接交叉联接的结果没有任何不同?我认为交叉连接会产生笛卡尔积,但两个连接都给了我 326 行。我还在某处看到我不应该使用非唯一数据?

最佳答案

来自MySQL JOIN文档:

In MySQL, JOIN, CROSS JOIN, and INNER JOIN are syntactic equivalents (they can replace each other). In standard SQL, they are not equivalent. INNER JOIN is used with an ON clause, CROSS JOIN is used otherwise.

关于mysql - 内连接和交叉连接产生相同的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29157829/

44 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com