Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

Equi Join and natural join

Equi Join

Equi join is a special type of join in which we use only equality operator. Hence, when you make a query for join using equality operator then that join query comes under Equi join.

Example:

SELECT
ProductName AS [Product Name]
,UnitPrice AS [Price]
,CategoryName AS [Product Category],ImagePath AS [Image]
FROM Products P
JOIN Categories C ON P.CategoryID=C.CategoryID
--Note:Using Clause is not supported by SQL Server



Note
Inner join can have equality (=) and other operators (like <,>,<>) in the join condition.

  • Equi join only have equality (=) operator in the join condition.
  • Equi join can be an Inner join, Left Outer join, Right Outer join
  • The USING clause is not supported by SQL Server .

 

 Natural Join

Natural join is a type of equi join which occurs implicitly by comparing all the same names columns in both tables. The join result have only one column for each pair of equally named columns.

Natural Join Example

SELECT * FROM Products
NATURAL JOIN Categories
Note : not supported by sql server ,error message from sql server  “Incorrect syntax near ‘Categories’.



Invalid entry,please enter valid data.

Loading