1
I have a table in the following structure:
| campo1 | campo2 | campo3 | campo4 |
| --------------------------------- |
| valor1 | valor2 | valor3 | valor4 |
| valor5 | NULL | NULL | valor8 |
Among other columns not relevant
I’m restructuring the bank, and I need to turn it into a structure like this:
| campo |
| ------ |
| valor1 |
| valor2 |
| valor3 |
| valor4 |
| valorN |
Is it possible to do this only with SQL? How?
They are exact 4 columns that I need to turn into 4 rows or less (some fields are null). The primary key is not being referenced anywhere else, not being imported (it already deletes the field and I will insert it again when the table is restructured)
The problem is that I need to change the table structure, not just bring the data in a different way
– Costamilam
I added an example of insertion in another table.
– William John Adam Trindade
I didn’t know it was possible to insert an "array" by SQL, I thought I needed to put several
VALUE( ... )
, thanks for the help– Costamilam
Thanks, I’ll get some lines of the results and compare to see if it’s all right
– Costamilam