So you have the first table name jobs
id | name | notes |
---|---|---|
1 | job1 | my notes |
2 | job2 | my notes |
Then I have a second table name extra_fields where jobs_id(foreign key)
id | jobs_id | extra_field | extra_field2 | extra_field3 |
---|---|---|---|---|
11 | 1 | new data | new data2 | null |
12 | 2 | null | null | new data3 |
So what I want is the user should be apple to make a extra_field4(a new column) if needed for some new data.
Don't no if this the best way to go around it, so when user want an extra input field, in the background make this code
ALTER TABLE extra_fields
ADD extra_field4 varchar(255);
The user will only see a html page where the user should be apple to add new "extra_fields"?
Hope it make sense, at the end make some restructure in db?
CodePudding user response:
Basically you can add column by next command:
ALTER TABLE extra_fields ADD COLUMN extra_field4 varchar(255);