Hi,
While working with SQL, I needed to query through information linked by 5 tables.
I wanted to use INNER JOIN to link the tables together meanwhile my supervisor suggested using the WHERE to link the query..
Here's the two examples..
1)
SELECT * FROM tbl1 A
INNER JOIN tbl2 B ON A.id = B.id
INNER JOIN tbl3 C ON B.id2 = c.id2
OR
2)
SELECT A.*, B.*, C.*
FROM tbl1 A, tbl2 B, tbl3
WHERE A.id = B.id AND B.id2 = c.id2
My question is, which one is better suited in terms of efficiency and resources?
My supervisor says using INNER JOIN causes a lot of overhead and gets worse with larger databases needing more tables to join meanwhile (2) does the same but a lot better.
If so, when is INNER JOIN used then if it causes more overhead?
thanks in advance
While working with SQL, I needed to query through information linked by 5 tables.
I wanted to use INNER JOIN to link the tables together meanwhile my supervisor suggested using the WHERE to link the query..
Here's the two examples..
1)
SELECT * FROM tbl1 A
INNER JOIN tbl2 B ON A.id = B.id
INNER JOIN tbl3 C ON B.id2 = c.id2
OR
2)
SELECT A.*, B.*, C.*
FROM tbl1 A, tbl2 B, tbl3
WHERE A.id = B.id AND B.id2 = c.id2
My question is, which one is better suited in terms of efficiency and resources?
My supervisor says using INNER JOIN causes a lot of overhead and gets worse with larger databases needing more tables to join meanwhile (2) does the same but a lot better.
If so, when is INNER JOIN used then if it causes more overhead?
thanks in advance