SQL Joins

« Previous Tutorial Next Tutorial »

SQL JOIN keyword is used to combines the rows from two or more tables, based on the common field between them.

Types of SQL JOIN Keyword

There are the following different types of JOIN available in SQL:

SQL JOIN Keyword Example

Here is an example of SQL JOIN Keyword. Let's look at the following table we have i.e., the "Admissions" table:

sql joins keyword

Let's look at the following one more table we have i.e., the "Students" table:

sql joins clause

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
ON Admissions.StudentID=Students.StudentID;

After querying the above SQL statements, you will get the following output:

sql inner join

« Previous Tutorial Next Tutorial »

Latest 5 Posts by CodesCracker


Quick Links
Signup - Login - Give Online Test