Discuss INNER JOIN ON vs WHERE clause (with multiple FROM tables)
Discuss INNER JOIN ON vs WHERE clause (with multiple FROM tables)
Two syntaxes express the same inner join:
-- explicit ANSI join: join condition in ON
SELECT o.id, c.name
FROM orders o
INNER JOIN customers c ON c.id = o.customer_id
WHERE o.total > 100;
-- implicit join: tables listed in FROM, condition in WHERE
SELECT o.id, c.name
FROM orders o, customers c
WHERE c.id = o.customer_id
AND o.total > 100;
For inner joins the optimizer treats both as identical, so there is no performance difference. The explicit form is still preferred.
JOIN ... ONON) from which rows you want (WHERE).JOIN the missing ON is a syntax error.Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.