Terminology
  
    base table:
                pivot_row pivot_column pivot_value
                --------- ------------ -----------
                1         A             x
                1         B             y
                1         C             z
                2         A             p
                2         B             d
                2         C             q
  
    pivot table:
                pivot_row A   B   C
                --------- --- --- ---
                1         x   y   z
                2         p   d   q
  
  Note: pivot_row + pivot_column must be unique.