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. iframe设置高度为100%

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. JavaScript之 for...in

    for-in 可以用来枚举对象的属性,还有数组的索引,用法: 枚举对象属性 var o={name:'a',age:25,sex:'male'} for(var each in o){ console ...

  3. 通过SSH实现Windows与linux之间传输文件

    Linux是非常好的开发环境,但很多时候我们希望能够在Windows上操作,通过SSH协议可以实现两者之间传输文件. 一 需要在Linux系统上安装ssh-server,有的linux系统自带了. 查 ...

  4. 【数据分析】Superset 之一 准备

    https://segmentfault.com/a/1190000005083953 http://blog.csdn.net/bingoxubin/article/details/78583165 ...

  5. 【RF库测试】set variable if

  6. flask + mysql写的简单监控系统

    这里以监控内存使用率为例,写的一个简单demo性程序,具体操作根据51reboot提供的教程写如下. 一.建库建表 创建falcon数据库: mysql> create database fal ...

  7. web移动前端页面,jquery判断页面滑动方向

    /*判断上下滑动:*/ $('body').bind('touchstart',function(e){ startX = e.originalEvent.changedTouches[0].page ...

  8. WP8.1学习系列(第十七章)——Windows Phone重要图形、视觉指示器和通知

    美感在手机应用中是不可或缺的,它是直观操作的代名词.在 Windows Phone 中,你的磁贴.初始屏幕.图标.控件和导航的视觉元素会引起用户对应用程序内的相关任务.优先事项或操作的注意,并采用新颖 ...

  9. 【宝塔】 安装扩展Memcached redis 教程

    宝塔官网: www.bt.cn 开始安装 1 进入ssh 输入以下指令, wget -O ext.sh http://125.88.182.172:5880/ext/ext.sh && ...

  10. Excel2010如何合并列数据

    小编以下图的Excel数据文件为例,如下图,有两列数据,第一列是歌曲名,第二列是该歌曲的演唱者,他们是有关联呢,那么如何把他们合并到同一列呢.   首先点击第3列的开始空白格,在这里编辑公式 =a1& ...