DBMS Notes

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 condition. Equi uses the comparison operator (=).

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

Syntax

Select * from Employee, Department where <Condition>

Example:

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

SQL

SQL for 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 above SQL

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

Help Other’s By Sharing…

Contact Us

Burewala, Vehari, Punjab, Pakistan

cstaleem1@gmail.com

Website: CStaleem.com

Pin It on Pinterest