Database notes,
NOTE Records:
========================================================== ====
Left Outer join
Involved tables: student, student, and fee_info:
Two table applications:
Query 1:
Query 2:
The difference can be seen from the comparison. query 2 is more than query 1. One Fengjie record (s. number of this record does not have the corresponding f. feeId)
Query 1: when the corresponding f. feeId cannot be found in s. number, this record is automatically filtered out.
Query 2: The Outer join uses left join and queries the main table s. When the corresponding f. feeId cannot be found in s. number, it is also queried.
Three table applications:
Query 1:
Query 2:
At this time, it is the association of three tables. It is similar to the association of two tables.
The difference can be seen from the comparison. query 2 is more than query 1. One Fengjie record (s. number of this record does not have the corresponding f. feeId)
Query 1: when the corresponding f. feeId cannot be found in s. number, this record is automatically filtered out.
Query 2: The Outer join uses left join and queries the main table s. When s. number cannot find the corresponding f. feeId, f. when the corresponding objId cannot be found for ojbId, it will also be queried.
========================================================== ============================================
Union table join
Condition for using union: The field type and number of fields must be the same.
Involved table: A table test_union, in sequence as follows:
Application: remove records with duplicate data and empty address (records in the red box in the figure)
1 ):
2 ):
3): splice tables in steps 1 and 2
The result is the desired result. It is successful .............................