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

  • UNION or           UNION ALL

  • Subquery in the select list

    Before MySQL 5.7.11, subqueries in the select list fail for           INSERT, but are okay for           UPDATE,           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          clause

  • 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)

  • 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 for           UPDATE,           DELETE)

21.5.3 Updatable and Insertable Views的更多相关文章

  1. 好程序与差程序Good Programming, Bad Programming

    好程序与差程序 Good Programming, Bad Programming 发布时间: 2012-11-20 16:32:21| 阅读数:2,735 views 优秀的程序可以使复杂的东西看起 ...

  2. oracle中imp命令详解 .

    转自http://www.cnblogs.com/songdavid/articles/2435439.html oracle中imp命令详解 Oracle的导入实用程序(Import utility ...

  3. [转]Hibernate设置时间戳的默认值和更新时间的自动更新

    原文地址:http://blog.csdn.net/sushengmiyan/article/details/50360451 Generated and default property value ...

  4. Serenity框架官方文档翻译3.2(多租户)

    3.2多租户 在本教程中我们将把Norhwind变成一个多租户应用程序. 这是一个维基百科的多租户软件定义: 软件多租户是指一个软件架构的一个实例软件运行在一个服务器和多个租户.租户是一组共享一个公共 ...

  5. MyEclipse安装插件的几种方式(适用于Eclipse或MyEclipse其他版本)

    MyEclipse2014安装插件的几种方式(适用于Eclipse或MyEclipse其他版本)  2014-04-28 21:09  MyEclipse  阿超  19171 views 众所周知M ...

  6. Hibernate 只获取外键id,不获取内容

    Hibernate,jpa注解映射中 A多对一B A的表中有B的外键. 如果想只获取A表中的B的外键而不想发送查询B的sql语句. 那么: @ManyToOne(fetch=FetchType.LAZ ...

  7. Devexpress GridControl z

    http://minmin86121.blog.163.com/blog/static/4968115720144194923578/ 1 AllowNullInput=False; --Devexp ...

  8. oracle中imp命令具体解释

    oracle中imp命令具体解释 Oracle的导入有用程序(Import utility)同意从数据库提取数据,而且将数据写入操作系统文件.imp使用的基本格式:imp[username[/pass ...

  9. DBA 经典面试题(5)

    国外公司的Oracle DBA试题 Oracle DBA Interview Questions 1. How many memory layers are in the shared pool? 2 ...

随机推荐

  1. iOS Runloop的超级讲解

    这是目前看过的最好的一片中文讲解RunLoop的文章,推荐给大家看一下,原文链接:http://blog.ibireme.com/2015/05/18/runloop/ https://segment ...

  2. FTP匿名访问修复方法

    window2003 window2008

  3. 使用dshow抓取摄像头数据时,回调函数时间为0的问题

    在使用dshow抓取摄像头数据,调用dshow的回调函数,如果发现SampleTime一直为0,如下图 那极有可能是使用RenderStream函数连接Filter时,指定的第一个参数为 PIN_CA ...

  4. Selenium 基本用法

    如下,使用 Selenium 打开淘宝首页并获取页面源代码: from selenium import webdriver browser = webdriver.Chrome() # 声明一个浏览器 ...

  5. [Android] Nexus 7 二代连接 Windows 7

    Android 设备的三大 USB 连接模式 MTP:Media Transfer Protocol - 媒体传输协议,Windows 下最常见的连接模式,是微软一种可以管理便携存储设备的协议.MTP ...

  6. myeclipse环境优化

    在项目右键打开Project > Properties > BUILDERS,打开source的tab,选择你的目录,删之~重启myeclipse 以下转载自百度知道 优化一下,下面内容都 ...

  7. free -m 下的含义

    如下显示free是显示的当前内存的使用,-m的意思是M字节来显示内容.我们来一起看看. $ free -mtotal used free shared buffers cachedMem: 1002 ...

  8. Linux设备驱动剖析之SPI(一)

    写在前面 初次接触SPI是因为几年前玩单片机的时候,由于普通的51单片机没有SPI控制器,所以只好用IO口去模拟.最近一次接触SPI是大三时参加的校内选拔赛,当时需要用2440去控制nrf24L01, ...

  9. 【cs229-Lecture8】顺序最小优化算法

    ref:    blog:http://zhihaozhang.github.io/2014/05/20/svm4/ <数据挖掘导论> 真正的大神是当采用的算法表现出不是非常好的性能的时候 ...

  10. 【ORACLE 】 ORA-00031 标记要删去的会话(解决)

    在使用Oracle的过程中,会有使用了锁(for update)但又忘记释放锁的情况.这是就需要用到KILL语句了.(如果不知道KILL语句怎么用,可参考: http://www.cnblogs.co ...