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)DISTINCTGROUP BYHAVINGSubquery 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
FROMclauseSubquery in the
WHEREclause that refers to a table in theFROMclauseRefers 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 ...
随机推荐
- html+jquery制作网页地图
http://jvectormap.com/ <!--StartFragment --> JVectorMap 是一个显示矢量地图的jQuery插件.它使用 SVG 在Firefox 3 ...
- ckeditor4.4.6添加代码高亮
研究了很久才发现,在 ckeditor4.4.6中添加代码高亮超级简单啊,下面直接上过程 ckeditor4.4.6支持自定义代码高亮,利用Code Snippet插件并默认启用highlight.j ...
- vux ajax请求 及 跨域
1)使用 AjaxPlugin 插件(在组件里使用) 引入插件 import { AjaxPlugin } from 'vux' 初始化 export default { components: { ...
- SpringBoot(一)-- 知识点介绍
一.简介 Spring Boot是为了简化Spring应用的创建.运行.调试.部署等而出现的,使用它可以做到专注于Spring应用的开发,而无需过多关注XML的配置.简单来说,它提供了一堆依赖打包,并 ...
- Zabbix的自定义键值和自动发现功能监控Oracle数据库的表空间
前面介绍了利用Orabbix监控了,参考zabbix通过Orabbix监控oracle数据库,这里我们原先的模板中进行了修改,使用自动发现功能实现监控tablespace的使用情况. 1. 在被监控的 ...
- mac 常用的终端命令
OSX 的文件系统 OSX 采用的Unix文件系统,所有文件都挂在跟目录 / 下面,所以不在要有Windows 下的盘符概念. 你在桌面上看到的硬盘都挂在 /Volumes 下. 比如接上个叫做 US ...
- js replace replaceAll
今天因为一些原因来看这篇博文,测试了一下根本不对.replace根本没有string.replace("字符","字符")这样的写法,而是stringObjec ...
- FileReader类和FileWriter类的基本用法示例
package com.example.io; import java.io.File; import java.io.FileReader; import java.io.FileWriter; i ...
- Elasticsearch学习之深入搜索四 --- cross-fields搜索
1. cross-fields搜索 一个唯一标识,跨了多个field.比如一个人,标识,是姓名:一个建筑,它的标识是地址.姓名可以散落在多个field中,比如first_name和last_name中 ...
- rabbitmq在centos 7上的安装
一.安装步骤 参考了官网文档: http://www.rabbitmq.com/install-rpm.html#package-dependencies 这里大概介绍下. rabbitmq-serv ...