通过sql视图将数据插入到多个表中 [英] Inserting data into multiple tables through an sql view
问题描述
是否可以通过mysql中的视图将数据插入到多个表中?
Is there any way to insert data into multiple tables through a view in mysql?
推荐答案
MySQL参考手册对此内容进行了说明:
The MySQL Reference Manual says this about updatable views:
有些观点是可更新的.也就是说,可以在诸如
UPDATE
,DELETE
或INSERT
之类的语句中使用它们来更新基础表的内容.为了使视图可更新,视图中的行与基础表中的行之间必须存在一对一的关系.还有某些其他构造会使视图不可更新.
Some views are updatable. That is, you can use them in statements such as
UPDATE
,DELETE
, orINSERT
to update the contents of the underlying table. For a view to be updatable, there must be a one-to-one relationship between the rows in the view and the rows in the underlying table. There are also certain other constructs that make a view nonupdatable.
可以为可更新视图提供WITH CHECK OPTION
子句,以防止对select_statement中的WHERE
子句为true的行进行插入或更新. WITH CHECK OPTION
子句在MySQL 5.0.2中实现.
The WITH CHECK OPTION
clause can be given for an updatable view to prevent inserts or updates to rows except those for which the WHERE
clause in the select_statement is true. The WITH CHECK OPTION
clause was implemented in MySQL 5.0.2.
您可以在此处找到整篇文章
这篇关于通过sql视图将数据插入到多个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!