I have a table.
---------
| a | b |
---------
| a | b |
---------
I want to rotate it 45 degrees(clockwise or anti-clockwise) and save it into another table. For example, if I rotate it 45 degrees anti-clockwise, it will be:
-------------
| b |   |   |
-------------
| a | b |   |
-------------
| a |   |   |
-------------
Another example, when I rotate
-------------
| a | b | c |
-------------
| d | e | f |
-------------
| g | h | i |
-------------
It will change to
---------------------
| c |   |   |   |   |
---------------------
| b | f |   |   |   |
---------------------
| a | e | i |   |   |
---------------------
| d | h |   |   |   |
---------------------
| g |   |   |   |   |
---------------------
How to do this in SQL?