Saturday, 23 November 2019 16:56

What is SQL Join and how to use them?

Written by 
Rate this item
(0 votes)

Sql JOIN clause used to combine rows from many tables, based on a 

related column value among them.

 Suppose there are two tables orders and customers, in these tables 

there are two columns which is same in meaning and value, and is called CustomerID.

 

Then, we now create the following SQL statement (using INNER JOIN), 

which selects records that have matching values in these two tables:

 

SELECT Orders.OrderID, Customers.Name, Orders.Date

FROM Orders INNER JOIN Customers ON 

Orders.CustomerID=Customers.CustomerID;

 

There are the different types of SQL JOINs : 

INNER JOIN: to display records that have matching values in both tables

LEFT JOIN: display all records from the left table + the matched records from the right table

RIGHT JOIN: display all records from the right table + the matched records from the left table

FULL OUTER JOIN: display all records based on a match in either left or right table

Use google.com to know details of each of these joins 

 

Don't forget to like & share it. 

Connect with me if you want to learn - https://www.fiverr.com/mitsol

Read 573 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.
Login to post comments