Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JOIN/Where CONCEPTS

what is the difference between these two sql statements

a) select * from T1,T2 where T1.A=T2.A ;

b) select * from T1,T2 where T2.A=T1.A ;

I am getting the same output in both cases,is there any differences between both statements?

c) select * from T1 inner join T2 on T1.A=T2.A ;

What is the diffence between Statement C and a?in that case also getting the same output as of a and b...

Can Inner Joins also be written as sql statement a?

like image 754
F11 Avatar asked Dec 24 '12 12:12

F11


1 Answers

They are all essentially different ways to join two tables using the same join condition.

Between 1 and 2, there is absolutely no difference as far as the database is concerned.

The last option is the standardized join syntax - this is what you should be using in order to ensure your SQL is readable - this is what people reading your SQL will expect to see when you join tables.

like image 186
Oded Avatar answered Sep 28 '22 04:09

Oded