Use of INNER JOIN in SQL Server

Use of INNER JOIN in SQL Server:

(1) “INNER JOINS” is used to combine data from two or more tables, according to the related column similarity. It returns records having the same value in both tables.

(2) Syntax of “INNER JOIN” statements are:

SELECT Col1, Col2, …ColN
FROM table_name1
INNER JOIN table_name2
ON table_name1.col1 = table_name2.col1;

(3) Let’s take an example, Show VENDOR records according to the City Values of Customer using INNER JOIN.

(4) Select the database in the SQL server and click on the “New Query” button as shown.

Select the database in SQL server and click on the New Query

(5) After that new query editor open as shown.

SQL new query editor open

(6) After doing the above steps, write a query in the editor and press F5 (execute the query), as shown.

execute query for inner join

Source Code:

–// “INNER JOIN” statement
Select ‘Vendor’ AS Type ,Vendor.[No_],Vendor.[Name],Vendor.[Address],Vendor.[City]
from dbo.[CRONUS India Ltd_$Vendor$437dbf0e-84ff-417a-965d-ed2bb9650972] AS Vendor
Inner Join dbo.[CRONUS India Ltd_$Customer$437dbf0e-84ff-417a-965d-ed2bb9650972] AS Customer
ON Vendor.[City] = Customer.City
Where Vendor.[City] IN (‘New Delhi’,’Thunder Bay’,’Chicago’, ‘Maidstone’)
–// “INNER JOIN” statement

Use of CREATE DATABASE Statement in SQL
Use of OR Operator in SQL
SQL ORDER BY Statement
Issue in Installing AL Symbol in VS editor [Solved]
OnAfterValidateEvent (Table) Trigger Event– Microsoft Docs

Leave a Reply