mysql哪些视图会自动更新吗,更新MySQL中的视图

Some views are updatable. That is, you can use them in statements such as 07001, 07002, or 07003 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. To be more specific, a view is not updatable if it contains any of the following:

Aggregate functions (07004, 07005, 07006, 07007, and so forth)

DISTINCT

GROUP BY

HAVING

07008 or 07009

Subquery in the select list

Certain joins (see additional join discussion later in this section)

Nonupdatable view in the FROM clause

A subquery in the WHERE clause that refers to a table in the FROM clause

Refers only to literal values (in this case, there is no underlying table to update)

Uses ALGORITHM = TEMPTABLE (use of a temporary table always makes a view nonupdatable)

Multiple references to any column of a base table.

[ deletia ]

It is sometimes possible for a multiple-table view to be updatable, assuming that it can be processed with the MERGE algorithm. For this to work, the view must use an inner join (not an outer join or a 07008). Also, only a single table in the view definition can be updated, so the SET clause must name only columns from one of the tables in the view. Views that use 07009 are not permitted even though they might be theoretically updatable, because the implementation uses temporary tables to process them.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值