This discussion is archived
0 Replies Latest reply: Dec 9, 2013 7:39 AM by fe1cfe48-8b6a-40cf-b36e-92ac54f9f7f7 RSS

Which SQL is Faster??

fe1cfe48-8b6a-40cf-b36e-92ac54f9f7f7 Newbie
Currently Being Moderated

Hi All,

 

Can someone explain which one of the following SQL will be faster if i have a huge data set??? and why??

 

SQL 1:

SELECT T1.C1,T2.C2 FROM

Table_1 T1

INNER JOIN

Table_2 T2

ON T1.C1=T2.C1

WHERE T1.C3 NOT IN ('12%','99%');

 

SQL 2:

SELECT T1.C1,T2.C2 FROM

Table_1 T1

INNER JOIN

Table_2 T2

ON T1.C1=T2.C1

WHERE SUBSTR(T1.C3,1,2) NOT IN ('12','99');

 

SQL 3:

SELECT T1.C1,T2.C2 FROM

Table_1 T1

INNER JOIN

Table_2 T2

ON T1.C1=T2.C1

WHERE SUBSTR(T1.C3,1,2) <> '12' OR  SUBSTR(T1.C3,1,2) <>'99';

 

SQL 4:

SELECT T1.C1,T2.C2 FROM

Table_1 T1

INNER JOIN

Table_2 T2

ON T1.C1=T2.C1

WHERE T1.C3 <>'12%'  OR  T1.C3 <>'99%';

 

Any suggestion with respect to SQL tuning will be of great help!!!!

 

Best Regards,

Mayur

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points