Tuesday, July 28, 2015

SQL Tutorial - Lesson 7 - Inner Join

Inner joins selects the rows from both the tables and displays the result provided there should be a match in the columns of both the tables

For example I have 2 tables


Table1: tblcountry

Country id
Country Name
1
USA
2
UK
3
SA
4
AUS
Null
Null

Table2: tblstate

Country id
State ID
Name
1
01
LA
2
02
London
4
03
Sydney

When you write the query

Select * from tblcountry inner join tblstate on tblcountry.country id=tblstate.country id

Out put

Country id
Country Name
State ID
Name
1
USA
01
LA
2
UK
02
London
4
AUS
03
Sydney


In the above query SQL joined both the tables which has a match

No comments:

Post a Comment