Home > Miscellaneous > Horizontal and Vertical Joins in SQL

Horizontal and Vertical Joins in SQL

Join is the most easiest thing that could ever happen to a table, may it be a horizontal or a vertical join. Though the word vertical is not common in terms of joins but it is a common type of join that is applied in day to day SQL queries.

A horizontal join is a join specified between 2 or more object (mainly tables) based on a common element specified in the tables they may include inner joins, outer joins, cross apply, cross joins, etc.

A vertical join is combining 2 or more tables vertically using a UNION or a UNION ALL clause. All the datatype for the tables should match sequentially while joining the tables vertically using UNION or UNION ALL clause.

Example: if first table has 3 columns with datatypes Int, Varchar and datetime then the next tables used in the union or union all clause should have 3 columns with the same datatype.

 

Post comments if this helps !!!

This Article is TAGGED in , , , , . BOOKMARK THE permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">