Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Unpivot Quarterly Columns

The table stores one column per quarter. Turn it into rows with the columns product, quarter and amount, ordered by product then quarter.

Table schema

Sales(product VARCHAR(20), q1 INT, q2 INT, q3 INT, q4 INT)

Sample data

product | q1 | q2 | q3 | q4
Pen | 10 | 20 | 30 | 40
Book | 1 | 2 | 3 | 4

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.