I am using mysql, I have a user table which holds some basic information like name, surname, age, gender, etc. I want to provide a feature called profile, where user will put other information like work location, alternative contact details, etc. These new columns are not fixed, in future there can me more columns. As of my knowledge there can be two approaches :
1) Add new columns every time when required, this will put Null entries to previous rows for newly added columns.
2) Add a new table which will contain all the columns ids to column names, and one more table which will contain key value like structure for each user who has the entry for that particular new column as follows :
Table1 : userId | firstName | age | ....
Table2 : columnId | columnName | dataType
Table3 : userId | columnId | value
Which would be the good approach for my scenario?