Intro to DBMS

EQUI JOIN

Equi Join is also known as an inner join. It is the most common join. It finds and returns the values which are based on equality conditions. Equi uses the comparison operator (=).

Note: Column names for the primary and foreign keys may or may not be the same because we use the “Where” clause in Equi-Join.

Syntax

Select * from Employee, Department where <Condition>

Example:

 It is necessary to find the Employee name (employee table) who is working in a department (Department table) having the location same as their address. Employee and department tables are in the following diagram

SQL

SQL for the above problem is given below

SELECT emp_no, emp_name, dept_no  From Employee ,Department  where employee.EMP_no =department.dept_Emp_no AND  employee.emp.address =department.dept_location.

Output of the above SQL

Take the cross product of both tables and calculate all those tuples where employees.EMP_no =department.dept_Emp_no AND  employee. emp.address =department.dept_location. So, the result will be as follows