How should the data of a table be selected through junctions?

Asked

Viewed 47 times

1

When using the SELECT to obtain data from tabela_A by making a junction with the tabela_B, normally, and believing it to be the correct form, we use some of the commands JOIN. 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 reading, IMO, and the second example saves some characters.

  • But what’s the difference in the use of the two?
  • There are issues of performance or different treatment of the data obtained?
  • I can say that only one example is the right way to do?

1 answer

2


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

In my case my college professors taught in both ways.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.