sql -- the difference between inner join, where, and left join

1.select a.name,a.sex,a.subject,a.age from TableA a, TableB b where a.name = b.name

2.select a.name,a.sex,a.subject,a.age from TableA a inner join TableB b ON a.name = b.name

3.select a.name,a.sex,a.subject,a.age from tablea a left join tableb b on a.name=b.name

 

the difference:

1. The result set returned by the where condition and inner join is the same. Both return all rows in both tables that satisfy the condition

2. Left join returns all the rows in the left table, even if there are no rows that meet the conditions in the right table, it will be returned.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325243996&siteId=291194637