Using the Join table, the defect is inner join, the left join used in development and the right join belong to outer join,outer join including full join
There are two tables, table A is the one on the left. Table B is the list on the right. Each of them has four records, of which two records have the same name:
The result of the 1.INNER JOIN is the intersection of AB
SELECT * from TableA INNER JOIN TableB on tablea.name = Tableb.name
A 2.LEFT [OUTER] JOIN produces a full set of table A, whereas a match in B table has a value, and no match is substituted with a null value. SELECT * from TableA left OUTER joins TableB on tablea.name = Tableb.name
A 3.RIGHT [OUTER] JOIN produces a full set of Table B, and a match in table A has a value, and no match is substituted with a null value.
SELECT * from TableA right OUTER joins TableB on tablea.name = tableb.name icons similar to left JOIN.
The 4.FULL [OUTER] JOIN produces a and B's set. For records that do not have a match, NULL is the value. SELECT * from TableA full OUTER joins TableB on tablea.name = Tableb.name can be found by means of NULL to find no matching values: SELECT * from TableA full O Uter JOIN TableB on tablea.name = Tableb.namewhere tablea.id are null OR tableb.id is null
5. Cross joins a n*m combination of the data from table A and table B, the Cartesian product. If this regular session produces 4*4=16 records, we must filter the data during the development process, so this is seldom used. SELECT * from TableA cross JOIN TableB
The difference between inner Join,outer join and cross join in SQL