Difference between the SQL Codes

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Wed, 08 Sep 2010 8:31 am

Good morning everyone, I would like your help to find out if there is no difference between the 2 SQL down..

Come on SQL SYSTEM 1:
Code: Select all
SELECT COLUNA 1,COLUNA 2... FROM TABELA 1, TABELA 2 , TABELA 3
WHERE TABELA 1 = TABELA 2 AND TABELA 2 = TABELA 3
SQL I acho MORE correct:
Code: Select all
SELECT COLUNA1, COLUNA2;;; FROM TABELA1
INNER JOIN TABELA2 ON TABELA2 = TABELA1
INNER JOIN TABELA3 ON TABELA3 = TABELA2
is there a difference between the 2 sql? Using SET TIMING ON returned the same time ... Do you have any explanation? What would be best to use? Why?

Thanks Jr
huntersc
Location: FLORIANOPOLIS - SC

Poston Wed, 08 Sep 2010 9:22 am

Hi Friend, the queries have the same semantics though the difference in the second syntax adopts the ANSI SQL standard, which is being recommended by Oracle since version 11 g (if not mistaken).
The first although it is more widespread among oracle programmers tends to fall into disuse over time.
Please friends correct me if I'm wrong, but that's my impression.
paulochagas
Location: São Paulo - SP

Paulo Chagas Filho
__________________

Analista Funcional / Desenvolvedor Oracle EBS
MSN - paulochagas@hotmail.com
Gtalk - pachafi@gmail.com
Skype - paulochagas

Poston Wed, 08 Sep 2010 11:59 am

beleza..

More about performance, the 2 perform the same way? Or 2 so that the oracle recommends is faster ...

Thanks
huntersc
Location: FLORIANOPOLIS - SC

Poston Wed, 08 Sep 2010 1:55 pm

At first the execution plan would be the same when used the same indexes/columns.
gfkauer
Location: Sapiranga - RS

Quem falou que programar era fácil??

Quanto mais dificil for a implementação mais valorizado seu trabalho será!

Acessem: www.gfkauer.com.br

Poston Wed, 08 Sep 2010 2:02 pm

[quote = " paulochagas "]Hi Friend, the queries have the same semantics though the difference in the second syntax adopts the ANSI SQL standard, which is being recommended by Oracle since version 11 g (if not mistaken).
The first although it is more widespread among oracle programmers tends to fall into disuse over time.
Please friends correct me if I'm wrong, but that's my impression.[/quote]

Someone would have some material from oracle recommending the syntax in question?
victorhugomuniz
Location: Rio de Janeiro - RJ

Jesus está voltando, volte antes para Ele.

Image JavaBlackBelt

Poston Thu, 09 Sep 2010 10:31 am

In the documentation for the following recommendation:
Oracle recommends that you use the FROM clause OUTER JOIN syntax rather than the Oracle join operator. Outer join queries that use the Oracle join operator (+) are subject to the following rules and restrictions, which do not apply to the FROM clause OUTER JOIN syntax:
Since Oracle 9i exists the recommendation, as the links below: http://download.oracle.com/docs/cd/B105 ... tm#2054625 http://download.oracle.com/docs/cd/E118 ... SQLRF52354 IPersonally I prefer the ANSI syntax because it clearly distinguishes and separates the JOIN conditions for each table WHERE filter.

A lot of people complain that there's too much verbiage ANSI syntax ... but I think every citizen of common sense knows that in the \"old\" syntax (all in where) you must use more comments on Where to separate what's where and what condition is used for which table joins us ...

Meanwhile, the ANSI syntax is more self-explanatory and explicit.
fsitja
Location: Gaúcho no Rio de Janeiro - RJ

"The scars exist to remind us that the past was real"
Campanha: Como fazer uma pergunta e obter uma resposta.
http://tkyte.blogspot.com/2005/06/how-t ... tions.html

OCA & OCP Developer — OCE SQL Expert — OCS Data Warehousing Specialist


  • See also
    Replies
    Views
    Last Post