I am facing a problem in writing a query for this question.Consider two random 3×3 (n=3) matrices A and B,having the following schema:
A(i,j,val) and B(i,j,val) where
i int:Row Index
j int:Coloumn Index
val int:Cell Value
Write a single query to get the matrix transpose(A) in the same format as A ie.,output tuples should be of format (i,j,val) where i is row, j is coloumn and val is cell value.
Best Answer
All you need to do is swap the indexes. Original:
Transposed: