Two existing tables
The first table is the boys' table, which records the boys' names and spouse numbers.
The second table is the girl table, which records the girl's name and ID.
First case: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Examples/examples + examples/nXvLnYwarFrsn6se08L3A + CjxwPr/J0tS/vMLH08PX88GsvdM8L3A + CjxwPjxpbWcgc3JjPQ = "http://www.2cto.com/uploadfile/Collfiles/20140617/2014061708594921.jpg" alt = "\">
Diaosi is a tragedy. She does not have a spouse in the girl table, so gname and gname. other are both NULL. Gao fushuai must be surrounded by beautiful women, so there are multiple lines of records.
Case 2:The host asks all girls to come on stage and bring their spouse. In this case, no matter whether a girl or not has a spouse, the table is associated with the table of boys based on the table of girls.
You can use left join.
Xiaomei is also quite tragic. There is no spouse in the boys' table, so both bname and bname. other are NULL. As for the relationship between Xiao Jiao, Xiao Zhi, and Xiao Lin with Gao fushuai and Xiao Wang, there are also many lines.
Case 3:The host asks all male and female with spouse to come to the stage. This is the internal connection.
Boy left join girl on boy. other = girl. other: Find the boy that meets the condition in the girl table. other = girl. the combination of other rows and the corresponding rows in the boy table. The boy table does not add NULL to the matched rows in the girl table.
Relationship between left and right connections and internal connections:
The left and right connections can be converted to each other. The A left join B on condition is equivalent to the B left join A on condition.
The join A inner join B on condition is the intersection of the left join B on condition and the B right join A on condition.