The equi JOINs and Inner JOINs are tricky in SQL. Many programmers think that both are same, but unable to tell where the functionally is different. So, I have selected this point to explain clearly where both differ each other.
The term equi join means joining two are more tables based on equal condition.
In the above example there are two tables ‘Customer mast’ and ‘Mem type mast’. The arrow mark shows that result of equi joins.
- How to review SQL program 5 key guidelines you need
- SQL Index Vs Key real differences to learn now quickly
- Stored procedures Vs Functions top differences refresh before your interview
- The Joins are formed based on equal ‘=’ condition in ‘WHERE’ clause . I mean to say that in ‘WHERE’ clause you can give ‘>’ or ‘<‘ condition. But in equi-join scenario only eaual condition is given.
- The result of equi join is the the matching rows will be joined based on the equal matching columns in both (or more) tables
- Do not confuse that a join can be formed on two or more tables.
- In equi-join the join condition is usually given in ‘WHERE’ clause
Example equi Join
The first table is “Customermast”
The result of equi Join is as follows
The term inner join means only matching rows in the first table are included. There is no concept of ‘LEFT INNER JOIN’ or ‘RIGHT INNER JOIN’
- In inner join, only matching rows of first table (TABLE A), will be formed in the result
- SQL query first it looks for each matching row of TABLE-A in TABLE-B. If matching rows present, those rows formed into result table
- You can give in inner join any condition like ‘=’,'<‘ and ‘>’. Here, it differentiates with equi Join.
- The above SQL query is also applicable for Inner join.