The difference and learning of LEFT RIGHT INNER JOIN in SQL

       Multi-table joins are often encountered in work. Now, let's talk about the usage of LEFT, RIGHT and INNER JOIN. The difference will come out after the usage. The writing is not professional, just to facilitate understanding and learning.

       First, let's talk about the use of INNER JOIN. INNER JOIN is to filter out the data with the same conditions in the two tables according to the ON condition , such as the Student table and the Course table as shown in the figure, to query those courses that Zhang Da has taken (for the convenience of using * to find out all the fields)

 

SELECT *

FROM Student s

INNER JOIN Course c

ON s. course number = c. course number

WHERE c. name="Zhang Da";

Analysis: The condition behind ON is  s.course number=c.course number . According to the condition, the two tables are the same as " 1101 ", so the result is

 

Guess you like

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