1
select s.id,s.name,e.sem from student as s, enroll as e where s.id = e.id;

select s.id,s.name,e.sem from student join enroll using (id);

so these 2 statements get the same result, but what is the difference? is there any case where they are not the same?

demalegabi
  • 577
  • 6
  • 19
  • 3
    nothing. They resolve to the same thing. The first is old-style joins in a where clause. Yuck. The second is the short form of modern joining .... the second one saves your from typing `on student.id=enroll.id` – Drew Sep 24 '16 at 06:20
  • `s.id = e.id` is the same thing which `join` here does . Difference is the style of the query executed . As @Drew said , First one is old style the another saves some bit of finger pain :D :p – Vikrant Sep 24 '16 at 06:22
  • Thanks for the answer – demalegabi Sep 24 '16 at 06:30
  • There are small differences between the two but they are not significant. A well-written program should not depend on these differences. – axiac Sep 24 '16 at 06:56

1 Answers1

0

they are the same thing, one is the old style while the other saves some time and typing.

demalegabi
  • 577
  • 6
  • 19