As long as there are more than two tables associated with the query, it will return a Cartesian product, the database will remove those redundant data, only return useful data. We use the left connection and the right connection when the query will be those redundant data also query out, there are two-way connection is also.
Left and right connections for Oracle databases
In Oracle Pl-sql, the left and right connections are implemented in the following way
View the following statement:
SELECT emp_name, Dept_name FORM Employee, Department WHERE employee.emp_deptid (+) = Department.deptid
This SQL uses a right connection, that is, the other side of the location of "(+)" is the direction of the connection, and the right connection indicates that all records on the right side of the equal sign are displayed, regardless of whether they are matched on the left, that is to say, whether there is a department without an employee in the previous example, The name of this department will appear in the query results.
Conversely: SELECT emp_name, Dept_name FORM Employee, Department WHERE Employee.emp_deptid = Department.deptid (+)
Is the left connection, regardless of whether the employee has a department number that can be matched in the department table, the employee's record will be displayed
General equal connections
SELECT * from a b where a.id = b.ID;
This is an internal connection.
EXP: (MySQL Universal)
Table1
col1 col2
1 2
3 4
table2
col3 col4
1 2
Select * FROM table1 a LEFT join table2 b
on a.col1=b.col3
Results
col1 col2 col3 Col4
1 2 1 2
3 4