SQL JOIN keyword is used to combines the rows from two or more tables, based on the common field between them.
There are the following different types of JOIN available in SQL:
Here is an example of SQL JOIN Keyword. Let's look at the following table we have i.e., the "Admissions" table:
Let's look at the following one more table we have i.e., the "Students" table:
Notice that the column "StudentID" in the table "Admissions" refers to the column "StudentID" in the table "Students".
Now we can perform the SQL JOIN operation to display the records of the two given table (above two table) here, having the common column StudentID.
For the SQL JOIN operation, both the tables must have at least one common column (here StudentID).
The relationship between the two tables shown above is the column "StudentID".
Then, if we run the following SQL statement (that contains an INNER JOIN):
SELECT Admissions.StudentID, Students.Name, Admissions.AdmissionYear FROM Admissions INNER JOIN Students ON Admissions.StudentID=Students.StudentID;
After querying the above SQL statements, you will get the following output:
© Copyright 2021. All Rights Reserved.