I have a form with inputs fields which can duplicated as many times as the user wants. Eg. - Educational Qualifications field, user can put in just 1 educational qualification or add 10 of them, what is the best way to store these in a database. I know i can serialise them in PHP or convert data inputted in those fields into JSON and then store it. But I know that is not ideal or the best practice. Can anyone guide me on the best way to it?
I am assuming you are using a table PersonDetails to store the details of a person. Donot store Education details in this table as there is a one to many relationship (one person can have many education detail rows). Create another table EducationQualification to store each education qualification and link both tables using 'personId'. Additionally you can also create foreign key constraint in 'personId' column of 'EducationQualification' table.
create table PersonDetails(personId integer primary key, name varchar(30));
insert into PersonDetails(personId,name) values(1, "praveen");
insert into PersonDetails values(2, 'naga');
insert into PersonDetails values(3, 'surya');
create table EducationQualification(QualificationID integer primary key, QualificationName varchar(30), personId integer);
insert into EducationQualification values (1, 'schooling', 1);
insert into EducationQualification values (2, 'degree', 1);
insert into EducationQualification values (3, 'postgraduate', 2);
insert into EducationQualification values (4, 'graduate', 2);