Saturday, January 9, 2021

How to convert columns into rows in SQL (Oracle Database)?

 Input:


Expected Output:

    



Query:

PIVOT_TABLE Data:

SELECT * FROM 

    (SELECT * 

        FROM PIVOT_TABLE)

        UNPIVOT(SALES FOR QUARTER IN (Q1, Q2, Q3, Q4));    

No comments:

Post a Comment