<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="drop-view">
      </a>
      15.1.35 DROP VIEW Statement
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045183225296">
  </a>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60288941"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DROP</span> <span class="token keyword">VIEW</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span>
    <em class="replaceable">view_name</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">view_name</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
    <span class="token punctuation">[</span><span class="token keyword">RESTRICT</span> <span class="token operator">|</span> <span class="token keyword">CASCADE</span><span class="token punctuation">]</span></code></pre>
  </div>
  <p>
   <a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
    <code class="literal">
     DROP VIEW
    </code>
   </a>
   removes one or more
      views. You must have the
   <a class="link" href="privileges-provided.html#priv_drop">
    <code class="literal">
     DROP
    </code>
   </a>
   privilege for each view.
  </p>
  <p>
   If any views named in the argument list do not exist, the
      statement fails with an error indicating by name which nonexisting
      views it was unable to drop, and no changes are made.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    In MySQL 8.3 and earlier,
    <a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
     <code class="literal">
      DROP VIEW
     </code>
    </a>
    returns an error if any
        views named in the argument list do not exist, but also drops
        all views in the list that do exist. Due to the change in
        behavior in MySQL 8.4, a partially completed
    <a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
     <code class="literal">
      DROP VIEW
     </code>
    </a>
    operation on a MySQL
        8.3 replication source server fails when
        replicated on a MySQL 8.4 replica. To avoid this
        failure scenario, use
    <code class="literal">
     IF EXISTS
    </code>
    syntax in
    <a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
     <code class="literal">
      DROP VIEW
     </code>
    </a>
    statements to prevent
        an error from occurring for views that do not exist. For more
        information, see
    <a class="xref" href="atomic-ddl.html" title="15.1.1 Atomic Data Definition Statement Support">
     Section 15.1.1, “Atomic Data Definition Statement Support”
    </a>
    .
   </p>
  </div>
  <p>
   The
   <code class="literal">
    IF EXISTS
   </code>
   clause prevents an error from
      occurring for views that don't exist. When this clause is given, a
   <code class="literal">
    NOTE
   </code>
   is generated for each nonexistent view.
      See
   <a class="xref" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
    Section 15.7.7.42, “SHOW WARNINGS Statement”
   </a>
   .
  </p>
  <p>
   <code class="literal">
    RESTRICT
   </code>
   and
   <code class="literal">
    CASCADE
   </code>
   , if
      given, are parsed and ignored.
  </p>
 </div>
 <br/>
</div>
