about 9 years ago
Joins
Joins in SQL are nothing but a technique to join the two table based on a common field.
- OrderID CustomerID OrderDate
- 10308 2 1996-09-18
- 10309 37 1996-09-19
- 10310 77 1996-09-20
- CustomerID CustomerName ContactName Country
- 1 Alfreds Futterkiste Maria Anders Germany
- 2 Ana Trujillo Ana Trujillo Mexico
- 3 Antonio Moreno Antonio Moreno Mexico
OrderID CustomerID OrderDate 10308 2 1996-09-18 10309 37 1996-09-19 10310 77 1996-09-20 CustomerID CustomerName ContactName Country 1 Alfreds Futterkiste Maria Anders Germany 2 Ana Trujillo Ana Trujillo Mexico 3 Antonio Moreno Antonio Moreno Mexico
There are two tables
To join
Then it shows this.
- OrderID CustomerName OrderDate
- 10308 Ana Trujillo 9/18/1996
- 10365 Antonio Moreno 11/27/1996
- 10383 Around the Horn 12/16/1996
- 10355 Around the Horn 11/15/1996
- 10278 Berglunds snabbkp 8/12/1996
OrderID CustomerName OrderDate 10308 Ana Trujillo 9/18/1996 10365 Antonio Moreno 11/27/1996 10383 Around the Horn 12/16/1996 10355 Around the Horn 11/15/1996 10278 Berglunds snabbkp 8/12/1996
This can be result.
The join are of three types.
1.Inner join
2.Outer join
3.Self join
0 Comment(s)