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
Web Service based application: Aims and Objectives Classics Online is a Web-based book and music retailer specialising in pre-1980s hardback

Our company is seeking a talented PHP Developer to join our young and dynamic online media agency. Must have: - Knowledge in SQL and Databases, proven indexing and coding exp

Show the code for the file dependency in cache? Partial Class Default_aspx Public Sub displayAnnouncement() Dim announcement As String If Cache("announcement") Is Noth

What are similarities between Class and structure? The similarities between structures and classes are as follows:- 1) Both can have constructors, properties, methods, field

Need Experienced Outlook (Microsoft Office) developer Your required skills: (1) A developer at heart, one that knows how to prepare modular, well-designed and clean code, (2) va

Custom authentication: If we don't need ASP.NET to perform any authentication, we can set the authentication mode to none. The reason behind this decision could be: We don't

What is project management? Applying the knowledge, skills, techniques, tools in project and deliver project deliverable is a short definition of the project management. It's b

List the new features added in .NET Framework 4.0. The following are the latest features of .NET Framework 4.0:     Improved Application Compatibility and Deployment Support

Need Report Generation in SQL / .NET Project Description: Prepare a report generation web page by pulling information from an SQL Database. Filter parameters per report :

What is a Web Service? The Web Services are the business logic components which provide the functionality via the Internet using standard protocols like HTTP. The Web Servic