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

Pivot Monthly Revenue by Product

Pivot the sales so that each product has one row and three columns Jan, Feb and Mar with the revenue of that month (0 when none). Order by product.

Table schema

Sales(product VARCHAR(20), month VARCHAR(3), revenue INT)

Sample data

product | month | revenue
Pen | Jan | 10
Pen | Mar | 5
Book | Feb | 20

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.