Do these MySQL SELECT queries represent different inner joins? [duplicate]
Possible Duplicate:
which query is better and efficient - mysql
What's the difference, if any, between these two (MySQL) SELECT queries?
SELECT开发者_如何转开发 name, salary
FROM employee, info
WHERE employee.id = info.id;
SELECT e.name AS name, i.salary AS salary
FROM employee AS e
INNER JOIN info AS i
ON e.id = i.id;
Both represent an (the same?) inner join on the tables employee
and info
.
Yes both represents INNER JOIN
.
SELECT e.name AS name, i.salary AS salary
FROM employee AS e
INNER JOIN info AS i
ON e.id = i.id;
is "explicit join notation"
uses the JOIN keyword to specify the table to join, and the ON keyword to specify the predicates for the join.
SELECT name, salary
FROM employee, info
WHERE employee.id = info.id;
The "implicit join notation"
simply lists the tables for joining (in the FROM clause of the SELECT statement), using commas to separate them. Thus, it specifies a cross join
, and the WHERE clause may apply additional filter-predicates (which function comparably to the join-predicates in the explicit notation).
Check out this example : http://en.wikipedia.org/wiki/Join_%28SQL%29#Inner_join
精彩评论