Showing posts from February 13, 2011

MSSQL Join Statements

Join Statements in MS SQL Management Studio. There are several different Join types in here I will discuss them: Inner Join Statement Left Outer Join Statement Right Outer Join Statement Self Join Statement Joining tables is one of the most useful operations we have. Large data should be divided to several tables (see Normalization Rules) for maximum flexibility and minimum resources usage. Inner Join Statement: Inner Join is meant for combining rows between two tables, based on at least one column with the same data. Although columns with the same data are the most common way to use the Inner Join, there is also a possibility to conduct it with "greater then", "not equal" etc. Example:     SELECT TOP 10 P.ProductID,         P.Name,         P.ListPrice,         S.UnitPrice,         S. OrderQty     FROM Sales.SalesOrderDetail S     INNER JOIN Production.Product P         ON S.ProductID = P.ProductID This is an example about a si