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
How many types of diagrams are there in UML? There are nine types of diagrams in the UML as shown below:- 1)Use case diagram: The use case diagram describe "WHAT" of a

Project Description: Looking for a developer who will develop a web portal like zulutrade, some features will be taken from signaltrader the changes ould be like: 1) only cer

WP7 get data from public API with XML or JSON Project Description: Hello, I'm seeking someone who knows his way around using an API with XML or JSON output in a windows phone

Project Description: I need a SharePoint Developer tutor to teach me the development of SharePoint from scratch. We will be communicating through TeamViewer and Skype. I have ac

What is Dataset object ? The DataSet gives the basis for the disconnected storage and manipulation of the relational data. We fill it from the  data store, work with it while d

Mention different types of data providers available in .NET Framework. .NET Framework Data Provider for SQL Server - Give access to Microsoft SQL Server 7.0 or later version. I

I want simple code for Outlook (express,2003,2007,2010,2013) Add-In with functionality to routinely send CC to the specified email(s), this system should have -Code for every th

What are value types and reference types?  Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort. Value types are

Project Description: The software is developed to help individuals train both their subconscious and conscious mind so they can improve their life and get more success. - How

What is DISCO? DISCO is a method developed by Microsoft to publish and discover Web services. It discovers URLs of all XML Web services located on a Web server and develops a