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
Install Modules to enhance Site Proformance Project Description: As shown, I need the subsequent modules installed, to improve loading time for my graphics and images, improv

Ask question #Minimum 100 words accepWrite an ASP.NET program that allows you to create and populate a CheckBoxList control by accessing the Title field from the Movies database ta

How can we get the state of the requested process? XMLHttpRequest get the current state of the request operation by using the readyState property. This property checks the cond

What is ASP.NET AJAX? ASP.NET AJAX, mostly called AJAX, is a set of extensions of ASP.NET. It is developed by Microsoft to execute AJAX functionalities in Web applications. ASP

Name the control that exposes the LINQ features to Web developers through the ASP.NET data-source control architecture. The LinqDataSource control exposes the LINQ features to

Can we run DOT.NET in UNIX platform? One of the drawbacks of using Visual Studio.NET and the .NET framework to develop applications has been the lack of cross-platform support.

What is shadowing? When 2 elements in a program have similar name, one of them can hide and shadow the one. Therefore in such cases the element which shadowed the main element

What is a class? A class explains all the attributes of objects, as well as the methods that execute the behavior of member objects. It is a comprehensive data type, which show

How do we connect to SQL SERVER, which namespace do we use ? The code is shown below, after that i will  give the explanation for it. For this sample we will also require a SQL

Name the two properties of the GridView control that have to be specified to turn on sorting and paging. The properties of the GridView control that require to be specified to