Different types of joins, DOT NET Programming

What are the different types of joins?

1) INNER JOIN:

The Inner join shows matches only when they exist in both the tables.For example, in the SQL below there are two tables Customers and Orders and the inner join in made on the Customers Customerid and Orders Customerid.Therefore  this SQL will only give you the result with customers who have orders.If the customer does not have order it will not display any record.

SELECT Customers.*, Orders.* FROM Customers INNER JOIN Orders ON

Customers.CustomerID =Orders.CustomerID

2) LEFT OUTER JOIN:

The Left join will display all the records in left table of the SQL statement.In SQL below the customers with or without orders will be displayed. The Order data for customers without orders appears as NULL values. For example, you want to determine the amount ordered by every customer and you need to see who has not ordered anything as well. You can also see the LEFT OUTER JOIN as a mirror image of the RIGHT OUTER JOIN (Is covered in the next part) if you switch the side of each table.

SELECT Customers.*, Orders.* FROM Customers LEFT OUTER JOIN Orders ON

Customers.CustomerID =Orders.CustomerID

3) RIGHT OUTER JOIN :

The Right join will display all records in the right table of the SQL statement. In the below SQL all orders with or without matching customer records will be displayed. The Customer data for orders without customers appears as NULL values. For example, you want to determine if there is any order in the data with undefined CustomerID values (say, after a conversion Or something like it). You can also see the RIGHT OUTER JOIN as a mirror image of the LEFT OUTER JOIN if you switch the side of every table.

SELECT Customers.*, Orders.* FROM Customers RIGHT OUTER JOIN Orders ON Customers.CustomerID =Orders.CustomerID

Posted Date: 9/24/2012 4:32:58 AM | Location : United States







Related Discussions:- Different types of joins, Assignment Help, Ask Question on Different types of joins, Get Answer, Expert's Help, Different types of joins Discussions

Write discussion on Different types of joins
Your posts are moderated
Related Questions
Can a .NET web application consume Java web service? Yes Offcourse.Actually Webservices are independent  to language. It depends on WSDL and SOAP. so any one can develope the W

What is the use of data adapter? The Data adapter are the objects that connect one or more Command objects to a Dataset object. They give logic that would get data from the dat

Php project for Narivramanarao For email Project Description: This is a project for Narivramanarao for emails and for php.rar please bid on the project and let's get started

What is the use of the CommandBuilder class? The CommandBuilder class is used to automatically update a database according to the changes made in a DataSet. This class autom

NameSpace Namespace consists of 2  main basic functionality :- NameSpace Logically types group , ex. System.Web.UI logically groups our UI related features. In Object O

ASP.NET/MSSQL/ MVC completing backend solution + integrating with frontend. - repost Project Description: System is used for tracking company's activities through several pro

I want a Panel for youtube views and facbook likes. I need a panel made that can increase facebook fanpage likes, and that will increase youtube video views. Youtube views an

What are indexes? The Indexes in the SQL Server are similar to the indexes in books. They help SQL Server to retrieve the data quickly.These are classified into clustered and n

This assignment is based on lectures, tutorials, computer labs and research work. 1. Background During the lectures and tutorials on business process modeling and business

Passport authentication A centralized service given by Microsoft, offers a single logon point for clients. Unauthenticated users are redirected to the Passport site