codescracker


sql

SQL Inner Join



« Previous Tutorial Next Tutorial »


SQL INNER JOIN keyword is used to select all the rows from both the tables as long as there is a match found between the columns present in both the tables. Here is the general form of the INNER JOIN keyword in SQL:

SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;

Or,

SELECT column_name(s)
FROM table1
JOIN table2
ON table1.column_name=table2.column_name;

SQL Demo Database

Let us assume that we have the following two table named "Admissions" and "Students".

In both the table we have one column (i.e., StudentID) which is common to both the table.:

sql inner join

sql inner join keyword

SQL INNER JOIN Keyword Example

Here is an example of INNER JOIN keyword in SQL. The following SQL statements will return all the Students with same StudentID from both the table named Students and Admissions:

SELECT Students.Name, Admissions.StudentID
FROM Students
INNER JOIN admissions
ON Students.StudentID=Admissions.StudentID
ORDER BY Students.Name;

It will display the following result:

sql inner join

« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test