I have a given dataframe:
id | listofnumbers |
---|---|
2 | [1, 2, 5, 6, 7] |
5 | [1, 2, 13, 51, 12] |
Where one column is just id, and the other one is list of number made like that which i got previously from JSON file, is there any way to get this into this format using only MySQL?
id | listofnumbers |
---|---|
2 | 1 |
2 | 2 |
2 | 5 |
2 | 6 |
2 | 7 |
5 | 1 |
5 | 2 |
5 | 13 |
5 | 51 |
5 | 12 |
I know it could be easily done using Python and pandas, but I only need to use MySQL in that case, and I do not really know how to transpose lists in MySQL like that
2
Answers
@Ruslan Pylypiuk
Postgresql soultion:
Mysql soultion : refer SQL split values to multiple rows
You can use json_table()
fiddle