Joins in SQL language

Joins in SQL language

there are many Join clause found in SQL.SQL also called structured query language is the language which helps to access and manipulate any databases. It has the features like insert, update, delete, create, store, set permission, etc on the database or to the tables on the database. Although SQL is an ANSI/ISO standard, there are different versions of the SQL language. it can also be used for making the database on the website.
There are many syntaxes on the SQL in order to change the values or the format of the tables in the database. One of the methods is the joining the multiple tables in one table. The join clause on the SQL is used to combine rows from the multiple tables which are related. There are many forms of Join on the SQL. They are
 

Inner join

In the inner join, the rows of the table are joined only the rows which have matching values. Only the values which are same are collected and placed in a separate table.
Inner join syntax
SELECT column_name(s)
FROM table1
INNER JOIN table2 ON table1.column_name = tale2.column_name;

Left join

In the left join, first, the data from the table 1 is matched to the data from the table 2. And the data which are matched in the table2 are written in table 1. Only the matched value is taken from the table 2 but all the data are taken from the table 1.
Left join syntax
SELECT column_name(s)
FROM table1
LEFT JOIN table2 ON table1.column_name = table2.column_name;

Right join

In the right join, first, the data from the table 1 is matched to the data from the table 2. And the data which are matched in the table1 are written in table 2. Only the matched value is taken from the table 1 but all the data are taken from the table 2. It is the opposite of the left join.
SELECT column_name(s)
FROM table1
RIGHT JOIN table2 ON table1.column_name = table2.column_name;

Full join

In the full join, like the left and right join the data are matched with each other and if the data are matched then the data can be written on either left or to the right side of the table. FULL OUTER JOIN can potentially return very large result-sets!
Full join syntax
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2 ON table1.column_name = table2.column_name;

Leave a Reply

Your email address will not be published. Required fields are marked *