Computer Science & IT – B.Tech, BCA, BBA, MCA, M.Tech Best Online Coaching Institute

JOINS and Types of Joins

INTRODUCTION TO JOINS

A join clause is used in relational database system to combine rows from two or more tables based on a common field between them. It is performed by using ‘where’ or ‘on’ clause in which specify the column name of both table and the condition is that data type should be same in both tables which combines the specified rows of tables.

Consider the following two tables Employees and Orders.

  • The employee table has attributes ID, Name, Age, Address, Salary,Mgrid
  • The Orders table has attributes OrderID, Date, Employee_ID, Amount,losal,hisal

Employees Table

ID Name Age Address Salary Mgrid
1 Komal 27 Faridabad 4000 2
2 Ramesh 24 Delhi 4500 6
3 Mamta 23 Kota 3000 3
4 Sonam 30 Bhopal 6500 1
6 Alka 28 Patna 2800 4

 

Orders Table

OrderID Date Employee_ID Amount Losal Hisal
100 2014-10-08 1 3000 2500 4600
101 2014-09-08 3 1500 2500 3500