In today’s article, we will be using the concept of Natural Join to join relational tables together.
Unlike others, Natural Join finds the relationships between the tables itself and does not require us to write an extra plpgsql statement to match columns, but it has advantages as well as disadvantages.
You wrote the plpgsql statement with natural join, integrated it into your application and it works with certain periods in the background, but you added matching columns in the tables you use, NATURAL JOIN does the operations by including those columns.
This can sometimes cause problems.
In the tables where you will use NATURAL JOIN, there must be one column with the same name.
In case of more than one, the result will not be returned.
General Usage
1 | SELECT*FROM table_name1 as nick_name1 NATURAL JOIN table_name2 as nick_name2; |
Example usage
1 | SELECT*FROM sehirler as s NATURAL JOIN meshuryiyecekler as my; |