21.5.3 Updatable and Insertable Views
http://dev.mysql.com/doc/refman/5.7/en/view-updatability.html
Some views are updatable and references to them can be used to specify tables to be updated in data change statements. That is, you can use them in statements such as UPDATE
, DELETE
, or INSERT
to update the contents of the underlying table. Derived tables can also be specified in multiple-table UPDATE
and DELETE
statements, but can only be used for reading data to specify rows to be updated or deleted. Generally, the view references must be updatable, meaning that they may be merged and not materialized. Composite views have more complex rules.
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 (
SUM()
,MIN()
,MAX()
,COUNT()
, and so forth)DISTINCT
GROUP BY
HAVING
Subquery in the select list
Before MySQL 5.7.11, subqueries in the select list fail for
INSERT
, but are okay forUPDATE
,DELETE
. As of MySQL 5.7.11, that is still true for nondependent subqueries. For dependent subqueries in the select list, no data change statements are permitted.Certain joins (see additional join discussion later in this section)
Reference to nonupdatable view in the
FROM
clauseSubquery in the
WHERE
clause that refers to a table in theFROM
clauseRefers only to literal values (in this case, there is no underlying table to update)
ALGORITHM = TEMPTABLE
(use of a temporary table always makes a view nonupdatable)Multiple references to any column of a base table (fails for
INSERT
, okay forUPDATE
,DELETE
)
21.5.3 Updatable and Insertable Views的更多相关文章
- 好程序与差程序Good Programming, Bad Programming
好程序与差程序 Good Programming, Bad Programming 发布时间: 2012-11-20 16:32:21| 阅读数:2,735 views 优秀的程序可以使复杂的东西看起 ...
- oracle中imp命令详解 .
转自http://www.cnblogs.com/songdavid/articles/2435439.html oracle中imp命令详解 Oracle的导入实用程序(Import utility ...
- [转]Hibernate设置时间戳的默认值和更新时间的自动更新
原文地址:http://blog.csdn.net/sushengmiyan/article/details/50360451 Generated and default property value ...
- Serenity框架官方文档翻译3.2(多租户)
3.2多租户 在本教程中我们将把Norhwind变成一个多租户应用程序. 这是一个维基百科的多租户软件定义: 软件多租户是指一个软件架构的一个实例软件运行在一个服务器和多个租户.租户是一组共享一个公共 ...
- MyEclipse安装插件的几种方式(适用于Eclipse或MyEclipse其他版本)
MyEclipse2014安装插件的几种方式(适用于Eclipse或MyEclipse其他版本) 2014-04-28 21:09 MyEclipse 阿超 19171 views 众所周知M ...
- Hibernate 只获取外键id,不获取内容
Hibernate,jpa注解映射中 A多对一B A的表中有B的外键. 如果想只获取A表中的B的外键而不想发送查询B的sql语句. 那么: @ManyToOne(fetch=FetchType.LAZ ...
- Devexpress GridControl z
http://minmin86121.blog.163.com/blog/static/4968115720144194923578/ 1 AllowNullInput=False; --Devexp ...
- oracle中imp命令具体解释
oracle中imp命令具体解释 Oracle的导入有用程序(Import utility)同意从数据库提取数据,而且将数据写入操作系统文件.imp使用的基本格式:imp[username[/pass ...
- DBA 经典面试题(5)
国外公司的Oracle DBA试题 Oracle DBA Interview Questions 1. How many memory layers are in the shared pool? 2 ...
随机推荐
- 线程同步 –AutoResetEvent和ManualResetEvent
上一篇介绍了通过lock关键字和Monitor类型进行线程同步,本篇中就介绍一下通过同步句柄进行线程同步. 在Windows系统中,可以使用内核对象进行线程同步,内核对象由系统创建并维护.内核对象为内 ...
- Git Step by Step – (3) Git对象模型
前面一篇文章介绍了本地仓库的一系列操作,下面我们将进一步了解Git的工作原理,介绍Git对象模型. 刚开始使用Git的时候,对Git对象模型.工作原理并不理解,但是经过一段时间的使用.熟悉之后,然后再 ...
- 【代码审计】CmsEasy_v5.7 代码执行漏洞分析
0x00 环境准备 CmsEasy官网:http://www.cmseasy.cn/ 网站源码版本:CmsEasy_v5.7_UTF8-0208 程序源码下载: http://ftp.cmseas ...
- Bypass ngx_lua_waf SQL注入防御(多姿势)
0x00 前言 ngx_lua_waf是一款基于ngx_lua的web应用防火墙,使用简单,高性能.轻量级.默认防御规则在wafconf目录中,摘录几条核心的SQL注入防御规则: select.+ ...
- iOS开发--打印NSRange,CGRect等结构体
使用对应的转换NSStringFromCGPoint NSStringFromCGSize NSStringFromCGRect NSStringFromCGAffineTransform ...
- PHP 中文字符串截取
$str = "abcdef啊啊吧啊"; function my_sub($str, $st ,$len){ $ret = ""; for( $st; $len ...
- SQL Server 索引结构及其使用(一)[转]
SQL Server 索引结构及其使用(一) 作者:freedk 一.深入浅出理解索引结构 实际上,您可以把索引理解为一种特殊的目录.微软的SQL SERVER提供了两种索引:聚集索引(cluster ...
- 【技术分享会】 @第五期 angularjs
前言 AngularJS 最初由Misko Hevery 和Adam Abrons于2009年开发,后来成为了Google公司的项目.AngularJS弥补了HTML在构建应用方面的不足,其通过使用标 ...
- Win8交互UX——键盘交互
设计用户可以通过硬件键盘.屏幕键盘或触摸键盘交互的 Windows 应用商店应用. 本主题介绍键盘交互的设计注意事项.有关实现键盘交互的信息,请参阅响应键盘输入. 键盘交互 键盘输入是 Windows ...
- JavaScript 闭包(Closure)
闭包(closure)是掌握Javascript从人门到深入一个非常重要的门槛,它是Javascript语言的一个难点,也是它的特色,很多高级应用都要依靠闭包实现. 闭包-无处不在 在前端编程中,使 ...