programplug Logo



SQL Inner Joins

Inner Join


  1. Inner join is also called as EQUIJOIN.
  2. It is most important and frequently used of joins.
  3. Inner join return all rows when there is atleast one combination match in both tables.
  4. It create a new result table by combining cloumn values of two tables which is based on the join predicate.
Syntax:
  SELECT tab1.col1, tab2.col2...
FROM tab1
INNER JOIN tab2
ON tab1.common_field = tab2.common_field;
Example:
E_ID E_NAME E_SALARY
201 Robert 37000
202 Michael 73500
203 Foster 45000
204 Luke 80000
Week off:
Shift_id E_AGE E_Day
201 41 Friday
202 37 Saturday
203 33 Sunday
204 35 Thursday

After Joining the table we get:

Example:
SELECT emp_id,e_name,e_salary   
FROM Employee e, week off o  
WHERE e.Emp_id =o.shift_id;
Result:
Shift_id E_NAME E_AGE E_SALARY
201 Robert 41 37000
202 Michael 37 73500
203 Foster 33 45000
204 Luke 35 80000