Changing the makeup of a relational table and summarizing it is the basic definition of a pivot table. Any one of a number of potential operations can be used to summarize a set of data. You could sum related rows under a common column, or find their average, or even find their median.
Most people know pivot tables as an operation in Excel, but you can also create powerful pivot tables just as easily by writing SQL in a data analytics tool.
Some data source types have a pivot like function built in and some do not. This can add to some confusion especially with the differences in syntax. For the purposes of this article we are going to show how to do this in PostgreSQL and Amazon Redshift in the absence of a pivot function.
For Chartio users, there are two different ways to create a pivot table with Amazon Redshift or PostgreSQL:
- Interactive Mode: using our Interactive Mode and Data Pipeline, you can easily create a pivot table in three steps and visualize your data.
- Standard SQL: simply write SQL to query your Amazon Redshift or PostgreSQL databases to create a pivot table and visualize it.
Whether you prefer using a drag-and-drop interface (Interactive Mode) or simply writing SQL, you can easily create a pivot table of your Amazon Redshift or PostgreSQL.
Continue reading our Data Tutorial and get the complete step-by-step guide in either SQL or our Interactive Mode: How to Pivot a Table with Amazon Redshift or PostgreSQL.