Greetings. I have a table (basic_data), when generating a "new project", each project inherits basic_data. But when the user wants to edit these, the ideal is that these modifications are in an "editable_basic_data" table, that is, where changes can be made without damaging the basic_data table.
Ways to handle the problem:
- Create a copy of basic_data to editable_basic_data and in this perform x operation
- A better idea or practice?
With this query I can create a table from another, but is there such a thing as an INSERT?
CREATE TABLE table2 AS SELECT * FROM table1;
When the query is done with the above statements, it does not create a primary key and apart from this, I would need to add other columns and data to the table to create the relationship fk_project id 1 to this copied data
PROCESS
The form is filled out and these go to the "project" table, each project must have basic_data. It would be a bad practice to use the basic_data to make modifications, therefore it would be necessary to create a new table that is related to each project and in this way make modifications
I am going to limit myself to answering this portion of your more specific question. For this you can use the syntax
INSERT INTO ... SELECT ...
: