Do the queries do the same? What is the standard?
Will I lose performance if I change one of these ways of write the query?
Query 1
SELECT a.*, b.id AS b_id
FROM table_a AS a
LEFT JOIN table_b AS b
ON a.id = b.id
Query 2
SELECT a.*, b.id AS b_id
FROM table_a a, table_b b
WHERE a.id = b.id
They return different results.
A LEFT JOIN statement will return rows even if there is no associated records in table_b that match table_a id. So it will return all rows in table_a, paired with EITHER a matching row in table_a OR a blank/null table_b row (if for that row in table_a there isn’t any matching row in table_b).
The second query is a shortcut for an INNER JOIN. This query will ONLY exclusively return rows that match the condition
a.id = b.id. The second query can also be written as:To answer your performance question, please see the answers on a related SO thread here.