Explain Natural join in oracle sql and plsql.Interview question and answer for fresher, intermediate and experienced candidates.

 



NATURAL JOIN:

It is the kind of join operation which creates join on the basis of the common columns in the tables. In order to perform this, there must be the common attribute between the tables. It will retrieve from the multiple tables. It will perform the cartesian product. It will find the consistent tuples and will delete the inconsistent tuples. It will delete the duplicate attributes.Usually,the common columns on which the tables are joined must have the same column name and have same datatype case, database does the join naturally and there is no need to mention common column using the ON clause.

Databases like MYSQL, SQL SERVER AND ORACLE will support this, but their syntax are slightly different. Table aliases are used before the column name in the select statement to avoid ambiguity in which the column names are unique. Performance issue may occur using this in case of large datasets.
It can be used in the multiple tables. It is the type of equijoin. It can be combined with the left, right and full outer joins. It is removing the explicit condition of the joins for simplying the queries. It will improve the readability while working with the tables having common columns. Less control is applied on the types of joins.Finally,output is retrieved by joining the two tables is unique columns.

select * from emp;


select * from dept;







select * from emp NATURAL JOIN dept;


select * from dept NATURAL JOIN emp;



Comments

Popular posts from this blog

Difference between union and union all in oracle sql plsql

Explain oracle pl sql datatypes interview question and answer for fresher and experienced.

Difference between full join and cross join-oracle sql plsql