1

From a client I got the following csv file:

font_id, fontstyle1, fontstyle2, fontstyle3
1,2,7
2,3,8
3,1
4,8,7,9

So there is 1 font per row, and each font can belong to multiple font styles. In the DB it will be multiple rows per font. So for instance font 1 will be:

font_id | font_style
1       | 2
1       | 7
2       | 3
2       | 8
3       | 1
4       | 8
4       | 7
4       | 9

So each font has a variable amount of font styles (so a variable amount of rows in the csv.

I have been looking but cant think of the right search phrase to find a solution. Could anyone point me in the right direction

Thanks in advance!

4
  • 1
    Hint: unpivot columns Commented Oct 29, 2018 at 15:51
  • 1
    You just need a bit of application code to parse the file. Does the order in which styles appear carry any innate meaning? Commented Oct 29, 2018 at 15:57
  • @Strawberry no it doesnt have any meaning. Normally I would write some script in python that would import this data. Just curious if mysql itself could do something like this Commented Oct 29, 2018 at 16:09
  • 1
    @LukaszSzozda Thanks for the hint! I found a question that can point me in the right direction: stackoverflow.com/questions/15184381/… and started a vote to close the question Commented Oct 29, 2018 at 16:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.