{"id":4460,"date":"2019-08-30T16:26:07","date_gmt":"2019-08-30T21:26:07","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=4460"},"modified":"2019-08-30T16:26:20","modified_gmt":"2019-08-30T21:26:20","slug":"how-to-drop-tables-and-columns-with-sql","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/","title":{"rendered":"How to Drop Tables and Columns with SQL"},"content":{"rendered":"<p>In the last article, we learned how to create a table for our database. We were working with a table of newsletter correspondents. Now, we are going to learn how to <strong>drop a table<\/strong> from our database.<\/p>\n<p>You may recall our goal in learning the basics of SQL was to be able to create, read, update, and delete items in our database. Dropping table covers the deleting portion of that goal. But tables aren&#8217;t the only thing you can drop. You can also drop columns from a table.<\/p>\n<h2>How to Drop a Database Table<\/h2>\n<p>Whether you are using MySQL via the command line, or if you have an application using some sort of relational database management program, the syntax for the table drop will be the same.<\/p>\n<p>Once logged into your program, you can use a command like this one:<\/p>\n<pre class=\"code_block\"><span style=\"color:blue;\">DROP TABLE<\/span> <em>respondents<\/em>;<\/pre>\n<p>In the example above, we have stuck with our former example of using our newsletter &#8220;respondents&#8221; table. This will have the effect of completely obliterating this table, and all of its data, from our database.<\/p>\n<p>This a very drastic move. Let&#8217;s imagine you only wanted to remove a certain column from the table. For example, perhaps the IP address collection field was no longer needed.In that case, you can simple drop that particular column from the database.<\/p>\n<h2>How to Drop a Column from a Table<\/h2>\n<p>Here, we are going to be deleting only the <em>IP address<\/em> column from our table of newsletter respondents.<\/p>\n<p>In order to do this properly, we are going to name the table we want to alter and which column we would like to drop.<\/p>\n<pre class=\"code_block\"><span style=\"color:blue;\">ALTER TABLE<\/span> <em>respondents<\/em> <span style=\"color:blue;\">DROP COLUMN<\/span> <em>ip_address<\/em>;<\/pre>\n<p>Using the above command, we have told SQL that we want to &#8220;alter&#8221; the table named <em>respondents<\/em> and drop the column named &#8220;ip_address&#8221; from it. Using this same statement, we can drop any column from our database that we require.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last article, we learned how to create a table for our database. We were working with a table of newsletter correspondents. Now, we are going to learn how to drop a table from our database. You may recall our goal in learning the basics of SQL was to be able to create, read,<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/\"> Read More ><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4305],"tags":[],"class_list":["post-4460","post","type-post","status-publish","format-standard","hentry","category-databases"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Drop Tables and Columns with SQL | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"In this article, we will show you how you can drop a table and column from your database.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Drop Tables and Columns with SQL | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"In this article, we will show you how you can drop a table and column from your database.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-30T21:26:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-30T21:26:20+00:00\" \/>\n<meta name=\"author\" content=\"Christopher Maiorana\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Maiorana\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/\"},\"author\":{\"name\":\"Christopher Maiorana\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\"},\"headline\":\"How to Drop Tables and Columns with SQL\",\"datePublished\":\"2019-08-30T21:26:07+00:00\",\"dateModified\":\"2019-08-30T21:26:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/\"},\"wordCount\":320,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Working with Databases\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/\",\"name\":\"How to Drop Tables and Columns with SQL | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2019-08-30T21:26:07+00:00\",\"dateModified\":\"2019-08-30T21:26:20+00:00\",\"description\":\"In this article, we will show you how you can drop a table and column from your database.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Drop Tables and Columns with SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\",\"name\":\"Christopher Maiorana\",\"description\":\"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Drop Tables and Columns with SQL | InMotion Hosting","description":"In this article, we will show you how you can drop a table and column from your database.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/","og_locale":"en_US","og_type":"article","og_title":"How to Drop Tables and Columns with SQL | InMotion Hosting","og_description":"In this article, we will show you how you can drop a table and column from your database.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2019-08-30T21:26:07+00:00","article_modified_time":"2019-08-30T21:26:20+00:00","author":"Christopher Maiorana","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Christopher Maiorana","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/"},"author":{"name":"Christopher Maiorana","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f"},"headline":"How to Drop Tables and Columns with SQL","datePublished":"2019-08-30T21:26:07+00:00","dateModified":"2019-08-30T21:26:20+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/"},"wordCount":320,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Working with Databases"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/","name":"How to Drop Tables and Columns with SQL | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2019-08-30T21:26:07+00:00","dateModified":"2019-08-30T21:26:20+00:00","description":"In this article, we will show you how you can drop a table and column from your database.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/how-to-drop-tables-and-columns-with-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Drop Tables and Columns with SQL"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f","name":"Christopher Maiorana","description":"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.","sameAs":["https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4460"}],"version-history":[{"count":1,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4460\/revisions"}],"predecessor-version":[{"id":47045,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4460\/revisions\/47045"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}