The SQL statement is as follows:
SELECT *
FROM table 1
Left join table 2 ON table 1.id = TABLE 2.id AND table 2. Name! = 'Ff'
WHERE table 1. NAME! = 'A'
Step 1: Return Cartesian Product (SELECT * FROM table 1 cross join table 2)
Step 2: Apply the ON filter (the current condition is table 1.id = TABLE 2.id AND table 2. Name! = 'Ff ')
Step 3: Add external rows
This step only applies to outer join. If left join is performed, the table on the LEFT is reserved. If right join is performed, the table on the RIGHT is reserved. The external row refers to retaining the rows in the table. Even if some rows are filtered out in step 2, rows filtered out in step 2 are added based ON the reserved table. This is not the case in the current example.
Step 4. Apply the WHERE filter (currently Name! = 'A') filter the data of the virtual table generated in the first three steps.
Conclusion: If the SQL statement uses Left Join, the conditions after On have no effect On the Left table and only filter the Right table. The Where statement can filter the Left table.
If the SQL statement uses Right Join, the conditions after On have no effect On the Right table and only filter the Left table. The Where statement can filter the Right table.