In sql, INNER JOIN is used to select all the records from two or more table where the condition is satisfied.

We can simply write JOIN instead of INNER JOIN and it would act same way.


Digrammatic Exaplanation

The diagrammatic representation states that all the rows for which the condition in table1 and table 2 is satisfied would be returned. Here common area is the portion that would be returned.


     Sql inner join by tutorialsinhand


Syntax of inner join

SELECT column1, column2,...,columnN
FROM table1 INNER JOIN table2
ON table1.column = table2.column;

We can select column from both the tables by specifying it as table1.column1, table1.column2,....., table2.column1, table2.column2 and so on in above query. See the example section for more clarity.


Example on inner join

We will take two tables tih_Courses and Registration as shown below:

Course_ID Course_Name Professor Mode_of_Training
001 .Net Mukesh Tiwari Online and Offline
002 Java Rajneesh Shukla Online and Offline
003 ANSI SQL Rajneesh Shukla Online
004 Basics of Computer Shweta  Online
Course_ID Course_Name Registered_Students Total_Strength
001 .Net 107 120
002 Java 118 130
009 Oracle 100 110
010 Ruby 80 90

Query-1: We will write sql query to fetch course name, professor and number of students registered using join on above two tables.

SELECT tih_Courses.Course_Name, tih_Courses.Professor,Registration.Registered_Students
FROM tih_Courses INNER JOIN Registration
ON tih_Courses.Course_ID = Registration.Course_ID;

On executing the above query successfully, we get following result:

tih_Courses.Course_Name tih_Courses.Professor Registration.Registered_Students
.Net Mukesh Tiwari 107
Java Rajneesh Shukla 118



Please Share this page
Views : 100
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!