SQL Inner Join Example

Inner Join is an SQL join which select the data that have the matching joined value or key from the two joined tables.

In this example two tables will be used, the Student table and the Student_Address table.

Student table:

Student_Address table:

Inner Join Statement

SELECT * FROM [DBO].[Student] st
  INNER JOIN [DBO].[Student_Address] sta 
  ON st.ID = sta.Student_ID;



The student table has 6 student with the ID 1 to 6. However, only the students with the ID 1 to 5 have data in the Student_Address table. When the Inner Join statement runs, the query select all the students that have the ID in the Student table that matched the Student_ID FOREIGN KEY in the Student_Address table.

Please leave a comment to let me know whether or not this example is helpful. If you have any question regarding SQL Inner Join, please let me know in the comment section of this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s