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开发之--条用第三方地图路线导航

    项目里面有位置功能,需要有导航,导航两种实现方式 (集成第三方SDK.URL跳转第三方应用) ,直接集成就不说,下面来说下通过url跳转, 最终效果如如下: 如果手机上安装的有客户端就展示,没有就不展 ...

  2. ios开发之--UIViewContentMode详解

    在开发当中有时会有这样的需求,将从服务器端下载下来的图片添加到imageView 当中展示,但是下载下来的图片尺寸大小不固定,宽高也有可能不成比例 如果直接设置imageView的image属性而不设 ...

  3. 【代码审计】JTBC(CMS)_PHP_v3.0 任意文件删除漏洞分析

      0x00 环境准备 JTBC(CMS)官网:http://www.jtbc.cn 网站源码版本:JTBC_CMS_PHP(3.0) 企业版 程序源码下载:http://download.jtbc. ...

  4. iOS开发--打印NSRange,CGRect等结构体

    使用对应的转换NSStringFromCGPoint   NSStringFromCGSize   NSStringFromCGRect  NSStringFromCGAffineTransform  ...

  5. URL地址重写例子(Helicon)

    # Helicon ISAPI_Rewrite configuration file# Version 3.1.0.86 #RewriteEngine on RewriteRule ^/esf/.+( ...

  6. 《转载》脚本实现从客户端服务端HTTP请求快速分析

    本文转载自https://www.imooc.com/article/14107 首先我想介绍下,分享这个脚本的用处: 当客户告知我们,一个页面http://www.xxx.com 有问题时,作为PE ...

  7. php安装xdebug后var_dump输出没有格式化的问题

    开发环境,装了一个xdebug扩展方便调试代码. 但是环境配置好了之后却发现xdebug加载成功了但是var_dump输出的内容却没有使用html格式化 这时想到估计是php.ini里面的某个输出的配 ...

  8. linux-find【递归搜索文件名】

    1 命令格式: $ find <指定目录> <指定条件> <指定动作>   最常见示例:查找文件名(忽略大小写) $find . -iname sqlquery.j ...

  9. VMware Workstation 14 黑屏的一个解决办法

    近期很多朋友遇到了VMware Workstation 14开启或新建虚拟机后黑屏的现象,同时发现如果挂起虚拟机,可以显示挂起前最后的画面.显然,虚拟机核心是正常工作的,只是“显示”方面出现了问题. ...

  10. linux个性化定制登录信息

    1./etc/motd /etc/motd即messageoftoday(布告栏信息),每次用户登录时,/etc/motd文件的内容会显示在用户的终端.系统管理员可以在文件中编辑系统活动消息,例如:管 ...