Skip to main content

Posts

Showing posts from June, 2012

Simple example for Pivot in SQL

In this Post I am going to explain pivot with a simple example. In  general Pivot means a point on which a part rotates. In same thing applies,Here the Pivoting means making the column change to a row . With out further defining I would like to demonstrate it with a simple example. Figure above shows a table with two columns .Now I would like to change the columns to rows  I have the procedure above  : this is the result generated by above procedure . Explaining the procedure: The first line selects the data as the defined header after being pivoted .next selects the columns key and value  from the pivot table while the statement after pivot makes the value column as header and the key as data under the column. I hope this Post would help the beginners who are new to the SQL and want to learn the basic syntax of pivot. Thank you for reading . Any suggestions regarding the post are welcome .