Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL - What data type should I use to store a Map field

I have a field on my Java object that is type

Map<String, ArrayList<Integer>>

and I am trying to figure out the best way to store it in a MySQL database. Does anyone have any suggestions as to what data type I should use?

like image 269
uesports135 Avatar asked Mar 21 '23 06:03

uesports135


1 Answers

You need to learn about relational databases and normalization.

You won't be storing a Map in MySQL. I can see a one-to-many relationship between two tables, where the parent is the table with the String key and the child is the one with many integer row values.

like image 192
duffymo Avatar answered Mar 23 '23 03:03

duffymo