C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » Databases »

SQL Server Joins


Posted Date: 24 Jun 2009    Resource Type: Articles    Category: Databases
Author: Vijayaragavan.RMember Level: Bronze    
Rating: 1 out of 5Points: 3



SQL Join:-
Sql Join is used to retrieve data from one or more tables joined by common fields.The most common field is Primarykey from one table and foreign key in another table.

They are two types of Joins are available in SQL SERVER

1). Inner Join (Equal Join)
2). Outer Join


1). Inner Join (Equal Join)

The INNER JOIN will select all rows from both tables as long as there is a match between the columns we are matching on.

EX:-
Select a.Emp_no, Emp_name, Department
from emp_master a, Dept_master b
where a.dept_id = b.dept_id

or

Select a.Emp_no, Emp_name, Department
from emp_master a inner join Dept_master b
on a.dept_id = b.dept_id


2) Outer Joins
They are two types of Outer joins are their.
a)Left outer join
b)right outer join


a). Left Outer Joins :

The LEFT OUTER JOIN or simply LEFT JOIN (you can omit the OUTER keyword in most databases),
selects all the rows from the first table listed after the FROM clause, no matter if they
have matches in the second table

Outer join syntax is as follows: -

SELECT a.*
FROM emp_master a left outer join dept_master b
ON a.dept_id = b.dept_id

b). Right Outer Joins :

The RIGHT OUTER JOIN or just RIGHT JOIN behaves exactly as SQL LEFT JOIN,
except that it returns all rows from the second table (the right table in our SQL JOIN statement).

Outer join syntax is as follows: -

SELECT a.*
FROM emp_master a Right outer join dept_master b
ON a.dept_id = b.dept_id



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
SQL Server Joins  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: To create a Job scheduler
Previous Resource: SQL: Combine Columns in SQL Server
Return to Discussion Resource Index
Post New Resource
Category: Databases


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use