Thursday 22 October 2009

Inner Join

An inner join is when you combine the rows of two tables based on a condition.

select * from customers on pet INNER JOIN customers.id = pet.id

A cross join is the complete data of all the combinations when picking a row from each of the two tables.


Out Join


A left outer Join combines two tables based on a condition. If condition is not met the result from the left table is returned with null entries added for the right table.

select * from customer on pet LEFT OUTER JOIN customers.id = pet.id

A right outer join is the same as left outer join but results from the right hand (second mentioned table in query) are returned

A full outer join combines the results of both left and right outer joins. Duplicate rows are not included.

No comments:

Post a Comment