We help IT Professionals succeed at work.

Inner Join or Not Inner Join...

slamhound
slamhound asked
on
I have a co-worker who has devised this method of querying multiple data tables:

SELECT * FROM Students, Bookings, RotaryClubs, Schools WHERE Students.RotaryID=RotaryClubs.RotaryID and Bookings.StudentID=Students.StudentID and Schools.SchoolID=Bookings.SchoolID

And much to my surprise, it seems to work!

Is there anything wrong with this method? What benefits do INNER JOINs give over this method?
Comment
Watch Question

None.
This will be optimised to the same as a the ansi standard inner join syntax - only available from v6.5 I believe.

You get benifit when using outer joins though as a lot of functionality was not available using the abreviated syntax

e.g.

select *
from a, b, c
where a.id *= b.id
and b.id *= c.id

is invalid
whereas

select *
from a
    left outer join
            (b left outer join c
                   on b.id = c.id
             )
         on a.id = b.id

is valid

Commented:
Agree with nigel.
The only thing you can benefit from inner joins is the better readability of the code.
>> The only thing you can benefit from inner joins is the better readability of the code.

Matter of opinion. Much prefer the abbreviated syntax as easier to format (and less typing).

Explore More ContentExplore courses, solutions, and other research materials related to this topic.