我试图解决this practice problem set中的#2。我的尝试是这样的:
/* My attempt */
SELECT o.ord_no, o.purch_amt, c.cust_name, c.city
FROM orders AS o
INNER JOIN customer AS c
ON o.customer_id = c.customer_id
WHERE o.purch_amt BETWEEN 500 AND 2000
但根据给定here网站的解决方案,它应该是这样的:
/* Correct solution */
SELECT a.ord_no, a.purch_amt, b.cust_name, b.city
FROM orders a, customer b
WHERE a.purch_amt
BETWEEN 500 AND 2000
我想如果我们没有明确定义JOIN
类型(如上面的解决方案中那样),那么SQL只会执行INNER JOIN
?显然,我的假设是错误的。有人可以解释一下我尝试和正确解决方案之间的区别吗?谢谢!