Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As documented under <a href="http://dev.mysql.com/doc/en/view-updatability.html" rel="noreferrer">Updatable and Insertable Views</a>:</p> <blockquote> <p>Some views are updatable. That is, you can use them in statements such as <a href="http://dev.mysql.com/doc/en/update.html" rel="noreferrer"><code>UPDATE</code></a>, <a href="http://dev.mysql.com/doc/en/delete.html" rel="noreferrer"><code>DELETE</code></a>, or <a href="http://dev.mysql.com/doc/en/insert.html" rel="noreferrer"><code>INSERT</code></a> to update the contents of the underlying table. 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:</p> <ul> <li><p>Aggregate functions (<a href="http://dev.mysql.com/doc/en/group-by-functions.html#function_sum" rel="noreferrer"><code>SUM()</code></a>, <a href="http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html#function_min" rel="noreferrer"><code>MIN()</code></a>, <a href="http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html#function_max" rel="noreferrer"><code>MAX()</code></a>, <a href="http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html#function_count" rel="noreferrer"><code>COUNT()</code></a>, and so forth)</p></li> <li><p><code>DISTINCT</code></p></li> <li><p><code>GROUP BY</code></p></li> <li><p><code>HAVING</code></p></li> <li><p><a href="http://dev.mysql.com/doc/en/union.html" rel="noreferrer"><code>UNION</code></a> or <a href="http://dev.mysql.com/doc/en/union.html" rel="noreferrer"><code>UNION ALL</code></a></p></li> <li><p>Subquery in the select list</p></li> <li><p>Certain joins (see additional join discussion later in this section)</p></li> <li><p>Nonupdatable view in the <code>FROM</code> clause</p></li> <li><p>A subquery in the <code>WHERE</code> clause that refers to a table in the <code>FROM</code> clause</p></li> <li><p>Refers only to literal values (in this case, there is no underlying table to update)</p></li> <li><p>Uses <code>ALGORITHM = TEMPTABLE</code> (use of a temporary table always makes a view nonupdatable)</p></li> <li><p>Multiple references to any column of a base table.</p></li> </ul> <p><code>[ deletia ]</code></p> <p>It is sometimes possible for a multiple-table view to be updatable, assuming that it can be processed with the <code>MERGE</code> algorithm. For this to work, the view must use an inner join (not an outer join or a <a href="http://dev.mysql.com/doc/en/union.html" rel="noreferrer"><code>UNION</code></a>). Also, only a single table in the view definition can be updated, so the <code>SET</code> clause must name only columns from one of the tables in the view. Views that use <a href="http://dev.mysql.com/doc/en/union.html" rel="noreferrer"><code>UNION ALL</code></a> are not permitted even though they might be theoretically updatable, because the implementation uses temporary tables to process them.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload