I have 2 table foo2 and foo3 with the pictures below. These tables have unique column -> id.
table foo2:
table foo3:
I want to select data from two tables with same id. I have 2 query like this
query1:
SELECT
foo2.id,
foo2.`name`
FROM
foo2
WHERE foo2.id IN (SELECT id FROM foo3);
query2:
SELECT
foo2.id,
foo2.`name`
FROM
foo2
INNER JOIN foo3 ON (foo2.id = foo3.id);
These queries return same data. I want to know which one is better? Which one is efficient?
Thanks for answers.