1.

Explain natural join.

Answer»

Natural Joins are a type of join that combines tables based on columns that share the same name and have the same datatype. Ideally, there should be a common attribute (column) among two tables in order to perform a natural join.

Syntax:

SELECT * FROM TableName1 NATURAL JOIN TableName2;

Example: Consider two tables Employee and Employment.

Employee

Emp_IDEmp_Name
1Khushboo Ahuja
2Kartik Sharma
3Milli Desai

Employment

Emp_IDEmp_Profile
1Content Writer
2Business Development Executive
3Marketing Manager

Now, consider the following query.

SELECT * FROM Employee NATURAL JOIN Employment;

Output:

Emp_IDEmp_NameEmp_Profile
1Khushboo AhujaContent Writer
2Kartik SharmaBusiness Development Executive
3Milli DesaiMarketing Manager



Discussion

No Comment Found