Posts

mssql joins

Image
What are SQL Joins ? SQLJoin is used to fetch data from two or more tables, which is joined as a single set of data. It is used for combining column from two or more tables by using values common to both tables. Types of Joins There are following types of Joins:- Inner Outer Left Right CROSS JOIN:- This type of JOIN returns the Cartesian product of rows from the tables in Join. It will return a table which consists of records which combines each row from the first table with each row of the second table. Cross JOIN syntax:- select column_names from  first_table CROSS JOIN second_table For Example: We have two tables Employees and city as shown below:- Cross join of these table is as:- INNER JOIN:- This is a simple JOIN which returns the matched data between two tables as per the equality condition  in the sql query. Inner Join Syntax is,                          SELECT  * FROM table1 INNER JOIN                          table2 ON E