Hi friends
I want to know how to work with inner joins in SQL Server. Please explain it with example.
Thank you
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
geetha velusamyPosted Nov 15, 2021, 1:24 PM
The INNER JOIN keyword selects records that have matching values in both tables.
Example Query:
SELECT Table_1.[Employee ID], Table_2.MarketID
FROM Table_1
INNER JOIN Table_2
ON Table_1.MarketID = Table_2.MarketID;
Here I have Two tables: Table_1 and Table_2, both having a column Employee Id and Market id.
The inner join returns the rows when there is at least one match in both tables.
Vipendra VermaPosted Apr 18, 2012, 6:55 PM
Satyapriya NayakPosted Apr 18, 2012, 1:53 PM
SQL INNER JOIN
The INNER JOIN keyword return rows when there is at least one match in both tables.
SQL INNER JOIN Syntax
FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_name
PS: INNER JOIN is the same as JOIN.
SQL INNER JOIN Example
The "Persons" table:
The "Orders" table:
Now we want to list all the persons with any orders.
We use the following SELECT statement:
FROM Persons
INNER JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
The result-set will look like this:
The INNER JOIN keyword return rows when there is at least one match in both tables. If there are rows in "Persons" that do not have matches in "Orders", those rows will NOT be listed.
Please refer the below link
http://www.w3schools.com/sql/sql_join_inner.asp
Thanks
SenthilkumarPosted Apr 18, 2012, 1:44 PM
The inner join is used to join one or more tables and returns the results from various table when condition matches.