Explain Equi join with an example

When two or more tables have been joined using the equal to operator then this category is called an Equi join. Just we need to concentrate on the condition that is equal to (=) between the columns in the table.

Employee Table

emp_id emp_name salary dept_id manager_id
E1 Rahul 15000 D1 M1
E2 Manoj 15000 D1 M1
E3 James 55000 D2 M2
E4 Michael 25000 D2 M2
E5 Ali 20000 D10 M3
E6 Robin 35000 D10 M3

Department Table

dept_id dept_name
D1 IT
D2 HR
D3 Finance
D4 Admin

Example

The following SQL selects employees’ names and departments’ names from the above-given tables where the department Id is the same.

SELECT e.emp_name,d.dept_name 
FROM Employee e, Department d
WHERE e.dept_id=d.dept_id

Output

emp_name dept_name
Rahul IT
Manoj IT
James HR
Michael HR

Code Runner

Copy the below query in the code runner to see the result

SELECT e.emp_name,d.dept_name 
FROM Employee e, Department d
WHERE e.dept_id=d.dept_id