I made a MySQL view with 4 tables. Is it possible to insert data into the view and have MySQL automatically pass the data into the right table?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- sqlyog export query result as csv
If you are using inner joins, and your view contains all the columns in the base tables, then your view might be updatable. However, for a multiple-table updatable view,
INSERT
can work if it inserts into a single table. You could split your insert operation into multipleINSERT
statements.You may want to check out the following article for more information on the topic:
Consider the following example:
Now let's create a view:
The following
INSERT
fails:But we can split it into two operations:
Result: