How should data be selected from a table through joins?

1

By using SELECT to get the data of tabela_A by joining with tabela_B , normally, and assuming it to be the correct form, we use some of the JOIN commands. Ex:

SELECT codigo, nome FROM tabela_A a
INNER JOIN tabela_B b ON b.fk_tabela_B = a.codigo

However, the same condition I can get using the following syntax:

SELECT codigo, nome FROM tabela_A a, tabela_B
WHERE b.fk_tabela_B = a.codigo

The first example has an easier read, IMO, and the second example saves a few characters.

  • But what's the difference in using the two?
  • Are there performance issues or differential treatment of the data obtained?
  • Can I say that only one of the examples is the correct way to do it?
asked by anonymous 25.02.2016 / 20:41

1 answer

2

The two examples are correct, the performance is the same as the returned data will be the same. The difference that the former can be used in any syntax. While join varies from one language to another. I hope I have clarified it.

In my case, my college professors taught in both ways.

    
25.02.2016 / 21:25