SQL Inner Join


SQL Inner Join

JOIN clause is used to combine rows from two or more tables, based on a related column between them.

INNER JOIN clause in SQL Server creates a new table (not physical) by combining rows that have matching values in two or more tables.

Below are the two tables Student and Department. Both of the tables are related with the DepartmentId.

Now, if we want to see the department names of each students, we can do an Inner Join to do that as follows:

					SELECT STUDENT.FirstName, STUDENT.LastName, DEPARTMENT.DepartmentName
ON STUDENT.DepartmentId = DEPARTMENT.DepartmentId

The above query will display the following result.

So in the above result we can get the department names of each students.

Please comment and share if you like this post and tell us about how we can enhance our posts. Thanks.


Comments (2)

  1. Mohamed Jabati

    I love sql

    1. That’s great

Comments are closed.