Left Join in Sql Server

Asked

Viewed 31 times

0

I have a question, there is some difference in executing the querys below?

SELECT C.NOMECARGO, F.NOMEFUNCIONARIO
FROM CARGO AS C
LEFT JOIN FUNCIONARIO AS F 
ON C.IDCARGO = F.IDCARGO
SELECT C.NOMECARGO, F.NOMEFUNCIONARIO
FROM CARGO AS C
LEFT JOIN FUNCIONARIO AS F 
ON F.IDCARGO = C.IDCARGO 
  • Ola, Both bring all the positions that have or do not work, the order of the keys does not matter in this case

  • So, regardless of the order of the keys my query will always be the same ?

  • that, the result is the same

  • André, thank you so much!!!

  • As @André said, the result will be the same, but it is good practice to adopt a standard. Here, at work, I use as default the second option you mentioned (first the table I’m doing Join and then the table I’m relating to.

  • Got it, thank you guys so much !!!

Show 1 more comment
No answers

Browser other questions tagged

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