SQL JOINS

DESCRIPTION

SQL JOINS are used to retrieve data from multiple tables. A SQL JOIN is performed whenever two or more tables are joined in a SQL statement.

There are 4 different types of SQL joins:

  • SQL INNER JOIN
  • SQL LEFT OUTER JOIN
  • SQL RIGHT OUTER JOIN
  • SQL FULL OUTER JOIN

Inner Join

Consider there are two tables as following

a) Student Table                                                           b) Advisor Table

student                            advisor

 

Now let us join these tables using INNER JOIN .

SQL>    SELECT * FROM Student S  

INNER JOIN Advisor A

ON

S.Advisor_Id=A.Advisor_Id

The result would be as follows.

innerjoin

 

Advertisements

One thought on “SQL JOINS

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s