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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
SenthilkumarRank #387 · 6.5K reputationPosted Apr 18, 2012, 9:44 AM EDT
The inner join is used to join one or more tables and returns the results from various table when condition matches.
Satyapriya NayakRank #47 · 31.5K reputationPosted Apr 18, 2012, 9:53 AM EDT
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
Vipendra VermaRank #473 · 5.3K reputationPosted Apr 18, 2012, 2:55 PM EDT
geetha velusamy52 reputationPosted Nov 15, 2021, 8:24 AM EST
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.