In MySQL, you can combine data from a relational table into a conditional filter by using an internal and external key link:
First create two new tables with the following data:
Student Table Data:
Score Table Data:
You can see that the records stu_id 16048008 in the students table have no data corresponding to the score table;
1. When an internal connection is made, the system automatically ignores the data that does not correspond to the two tables:
-- Show all data inside the connection: SELECT * from INNER JOIN on St.sid=sc.stu_id;
Too much data, only the end:
As you can see, the data is only displayed to 16048007,16048008 and is not displayed, so the inner join only shows all the associated data.
2. Left link, display all the data in the left table of the keyword, the right table data data is less than the null value, the data is not displayed;
-- left outer link SELECT * from Left JOIN on St.sid=sc.stu_id;
As you can see, 16048008 has no data in the right score table, and the system is null-padded,
SELECT * from Left JOIN on St.sid=sc.stu_id;
Is that we will students table and score table for a position of the running results, you can see that the right table 16048008 records, because in the left table clock no data corresponding, so it was deleted, you can see that the left link is the left table in the data as a reference, display all the data on the left table, the right table, Show only the data corresponding to the table on the left, with less fill null, more delete;
Similarly, the right link is to the right of the reference, the left is less than the null, more delete, here is not much to say;
The above can be drawn:
1. Internal connection, showing all the data in the two tables;
2. Left link, with left table as the reference, display all data;
3. Right link, the right table for the reference display data;
MySQL link left link right link difference