Posts

Showing posts from February 20, 2011

MSSQL Advanced Join Statements

Image
Advanced Join Statements in MS SQL Management Studio. There are several different Join types in here I will discuss them: Cross Join Statement Full 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. Cross Join Statement: In the Cross Join statement, based on the two tables within the Join, a Cartesian product is created if a 'Where' statement filter the rows.  The size of the Cartesian product is based on multyplying the number of rows from the left table by the number of rows from the right one. Be careful when using the Cross Join.  it might cause more damage than good. Example:     SELECT  TOP 100 P.ProductID,         P.Name,         P.ListPrice,         P.Size,    ...