lang_droptable.html 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html><head>
  3. <title>SQLite Query Language: DROP TABLE</title>
  4. <style type="text/css">
  5. body {
  6. margin: auto;
  7. font-family: Verdana, sans-serif;
  8. padding: 8px 1%;
  9. }
  10. a { color: #45735f }
  11. a:visited { color: #734559 }
  12. .logo { position:absolute; margin:3px; }
  13. .tagline {
  14. float:right;
  15. text-align:right;
  16. font-style:italic;
  17. width:240px;
  18. margin:12px;
  19. margin-top:58px;
  20. }
  21. .toolbar {
  22. font-variant: small-caps;
  23. text-align: center;
  24. line-height: 1.6em;
  25. margin: 0;
  26. padding:1px 8px;
  27. }
  28. .toolbar a { color: white; text-decoration: none; padding: 6px 12px; }
  29. .toolbar a:visited { color: white; }
  30. .toolbar a:hover { color: #80a796; background: white; }
  31. .content { margin: 5%; }
  32. .content dt { font-weight:bold; }
  33. .content dd { margin-bottom: 25px; margin-left:20%; }
  34. .content ul { padding:0px; padding-left: 15px; margin:0px; }
  35. /* rounded corners */
  36. .se { background: url(images/se.png) 100% 100% no-repeat #80a796}
  37. .sw { background: url(images/sw.png) 0% 100% no-repeat }
  38. .ne { background: url(images/ne.png) 100% 0% no-repeat }
  39. .nw { background: url(images/nw.png) 0% 0% no-repeat }
  40. </style>
  41. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  42. </head>
  43. <body>
  44. <div><!-- container div to satisfy validator -->
  45. <a href="lang.html">
  46. <h2 align="center">SQL As Understood By SQLite</h2></a><h1>DROP TABLE</h1><h4><a href="syntaxdiagrams.html#drop-table-stmt">drop-table-stmt:</a></h4><blockquote> <img alt="syntax diagram drop-table-stmt" src="images/syntax/drop-table-stmt.gif"></img> </blockquote>
  47. <p>The DROP TABLE statement removes a table added with the
  48. <a href="lang_createtable.html">CREATE TABLE</a> statement. The name specified is the
  49. table name. It is completely removed from the database schema and the
  50. disk file. The table can not be recovered. All indices and triggers
  51. associated with the table are also deleted.</p>
  52. <p>The DROP TABLE statement does not reduce the size of the database
  53. file in the default mode. Empty space in the database is retained for
  54. later <a href="lang_insert.html">INSERT</a> statements. To
  55. remove free space in the database,
  56. use the <a href="lang_vacuum.html">VACUUM</a> statement.
  57. If <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> mode is enabled for a database then space
  58. will be freed automatically by DROP TABLE.</p>
  59. <p>The optional IF EXISTS clause suppresses the error that would normally
  60. result if the table does not exist.</p>
  61. <p>If <a href="foreignkeys.html">foreign key constraints</a> are enabled, a DROP TABLE command performs an
  62. implicit <a href="lang_delete.html">DELETE FROM &lt;tbl&gt;</a> command before removing the
  63. table from the database schema. Any triggers attached to the table are
  64. dropped from the database schema before the implicit DELETE FROM &lt;tbl&gt;
  65. is executed, so this cannot cause any triggers to fire. By contrast, an
  66. implicit DELETE FROM &lt;tbl&gt; does cause any configured
  67. <a href="foreignkeys.html#fk_actions">foreign key actions</a> to take place.
  68. If the implicit DELETE FROM &lt;tbl&gt; executed
  69. as part of a DROP TABLE command violates any immediate foreign key constraints,
  70. an error is returned and the table is not dropped. If
  71. the implicit DELETE FROM &lt;tbl&gt; causes any
  72. deferred foreign key constraints to be violated, and the violations still
  73. exist when the transaction is committed, an error is returned at the time
  74. of commit.