FULL OUTER JOIN
Function
A full outer join (FULL OUTER JOIN) matches all records from the left table against all records from the right table and returns all records from both tables. For records without a matching value, the corresponding columns in the result set return NULL.
Syntax
SELECT attr_expr_list FROM table_reference FULL OUTER JOIN table_reference ON join_condition;
Parameters
| Parameter | Description |
|---|---|
| attr_expr_list | The list of query column expressions, specifying the columns to be returned. |
| table_reference | The table name or subquery to be joined. Must be an existing table. Otherwise, an error is reported. |
| FULL OUTER JOIN | FULL OUTER JOIN keyword. Returns all records from both the left and right tables. Records without a matching value return NULL. FULL JOIN is an abbreviation of FULL OUTER JOIN. |
| join_condition | The join condition, typically an equality comparison expression between columns of the two tables. |
| ON | The keyword specifying the join condition. |
Precautions
- The tables to be joined must already exist. Otherwise, an error is reported.
- FULL JOIN is an abbreviation of FULL OUTER JOIN. Both have identical semantics.
- The result set of a full outer join is equal to the union of a LEFT OUTER JOIN and a RIGHT OUTER JOIN.
Example
Using a FULL OUTER JOIN, all records from both tables can be returned. Records in the left or right table without a matching value will return NULL.
SELECT student_info.name, course_info.courseName FROM student_info FULL OUTER JOIN course_info ON student_info.courseId = course_info.courseId;
Equivalent syntax:
SELECT student_info.name, course_info.courseName FROM student_info FULL JOIN course_info ON student_info.courseId = course_info.courseId;
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot