Sql server - What is inner
join? - Nov 20, 2008 at 18:00 PM by Rajmeet Ghai
What is inner join? Explain with an example.
A SQL server Join is helps to
query data from two or more tables between columns of these tables. A simple
JOIN returns data for at least one match between the tables. The columns need
to be similar. Usually primary key one table and foreign key of another is
used.
Syntax:
Table1_name JOIN table2_name ON table1_name.column1_name=
table2_name.column2_name.
What is inner join? Explain with an example
Answer
INNER JOIN: Inner join returns rows when there is at least one match in both
tables.
Syntax:
SELECT column_name(s) FROM table_name1 INNER JOIN table_name2 ON
table_name1.column_name=table_name2.column_name
Example: To display records of an employee who got an appraisal.
SELECT employee.firstname, appraisal.amount FROM employee INNER JOIN appraisal
ON employee.id = appraisal.employee.id;
|