

{"id":23628,"date":"2018-08-13T06:29:06","date_gmt":"2018-08-13T06:29:06","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=23628"},"modified":"2021-03-10T21:53:25","modified_gmt":"2021-03-10T16:23:25","slug":"alter-command-in-sql-truncate","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/","title":{"rendered":"Alter Command In SQL | Truncate Table In SQL"},"content":{"rendered":"<p>SQL provides us with the flexibility to modify and delete a table after it\u2019s creation. We have data that needs to be put in the table and, at the same time, data that is of no use after a particular time.<\/p>\n<p>To keep our data updated, we need to take various measures, and table altering is one of those. Alter and Drop commands are applicable for the same.<\/p>\n<h3>Demo Database<\/h3>\n<p>Let us view the database that we will use here, using the SELECT query.<br \/>\n<strong>Syntax:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">SELECT * FROM tableName ;<\/pre>\n<p><strong>Query:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Select * from dataflair_employee ;\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86881\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1.png\" alt=\"SQL View Database\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1-1536x824.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1-520x279.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/view-database-1-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>We have 5 columns, namely:<\/strong><\/p>\n<ol>\n<li>name_emp<\/li>\n<li>post_emp<\/li>\n<li>email<\/li>\n<li>age<\/li>\n<li>salary<\/li>\n<\/ol>\n<h3>What is an Alter Command in SQL?<\/h3>\n<p>Alter command is applicable to add, modify, or update columns in an existing table. It is also applicable to drop or delete a table. The basic syntax of the alter command is as follows:<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE tableName\r\noperation columnName datatype;\r\n<\/pre>\n<p><strong>We can perform the following tasks using the Alter Command:<\/strong><\/p>\n<h4>1. ADD Column in SQL<\/h4>\n<p>Used to add a new column to the existing table.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE tableName\r\nADD columnName datatype ;\r\n<\/pre>\n<p><strong>Example 1:<\/strong> Let us add a gender column in the table.<br \/>\n<strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE dataflair_employee\r\nADD gender varchar(10);\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86883\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column.png\" alt=\"rename column in SQL\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column-1536x824.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column-520x279.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-column-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>2. MODIFY Column in SQL<\/h4>\n<p>Used to modify the already existing columns in a database. We can modify one or multiple columns at once.<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE tableName\r\nMODIFY columnName columnType;\r\n<\/pre>\n<p><strong>Example 1:<\/strong> Let us modify the size of our name column to 100 in varchar.<br \/>\n<strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE dataflair_employee\r\nMODIFY name_emp varchar(100);\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86882\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column.png\" alt=\"modify column in SQL\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column-1536x824.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column-520x279.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/modify-column-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>We can see the name_emp column has changed in size from varchar(50) to varchar(100).<\/p>\n<h4>3. RENAME Column in SQL<\/h4>\n<p>Rename is put with Alter to change the name of a column. This could be applicable due to various reasons, for example:<\/p>\n<ul>\n<li>To make the column name meaningful.<\/li>\n<li>Simplification of names for analysis.<\/li>\n<\/ul>\n<p>Let us rename our table and also the columns of our table.<\/p>\n<h4>Renaming the Table in SQL<\/h4>\n<p><strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE tableName\r\nRENAME TO newTableName \r\n<\/pre>\n<p><strong>Example 1:<\/strong> Let us rename our table from DataFlair_Employee to DataFlair_Info.<\/p>\n<p><strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE dataflair_employee\r\nRENAME TO DataFlair_Info ;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86884\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table.png\" alt=\"rename table in SQL\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table-1536x824.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table-520x279.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/rename-table-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>Renaming The Column in SQL<\/h4>\n<p><strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE table_name\r\nCHANGE COLUMN old_name TO new_name;\r\n<\/pre>\n<p><strong>Example 1:<\/strong> Let us rename our name_emp column to employeeName.<br \/>\n<strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE dataflair_info\r\nCHANGE COLUMN `name_emp` `employeeName` VARCHAR(100) ;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86890\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column.png\" alt=\"change column in SQL\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column-1536x824.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column-520x279.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/change-column-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>4. DROP Column in SQL<\/h4>\n<p>We use drop to remove the columns which are no longer required in the database. We should be very careful while we drop a column as data we delete once can\u2019t be retrieved.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE tableName\r\nDROP COLUMN columnName ;\r\n<\/pre>\n<p><strong>Example 1:<\/strong> Let us DROP the gender column from our DataFlair_info database.<br \/>\n<strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ALTER TABLE dataflair_info\r\nDROP COLUMN gender ;\r\n\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86887\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column.png\" alt=\"drop column in SQL\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column-1536x824.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column-520x279.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-column-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>We can see the gender column is no longer available in our database.<\/p>\n<h3>What is the Truncate Command in SQL?<\/h3>\n<p>We use the Truncate command to delete the data stored in the table. The working of truncate command is similar to the working of Delete command without a where clause.<\/p>\n<p><strong>Syntax:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">TRUNCATE TABLE tableName ;\r\n<\/pre>\n<h3>Difference between Truncate and Drop command in SQL?<\/h3>\n<p>Executing the truncate command deletes all the data stored in the table or database. Whereas the Drop command is applicable to destroy the whole object it could be a table, a database, or a schema.<\/p>\n<p>Also, syntax differences exist. Syntax of both are as follows:<\/p>\n<p><strong>SQL Truncate Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">TRUNCATE TABLE tableName ;\r\n<\/pre>\n<p><strong>Syntax of Drop:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">DROP TABLE tableName ;\r\n<\/pre>\n<p><strong>Example 1:<\/strong> Let us drop the table DataFlair_Info.<br \/>\n<strong>Query:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">TRUNCATE TABLE  dataflair_info;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86888\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table.png\" alt=\"truncate table in SQL\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table-1536x824.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table-520x279.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/truncate-table-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Example 2:<\/strong> Let us drop our table.<br \/>\n<strong>Query:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">DROP TABLE dataflair_info ;\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86889\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table.png\" alt=\"drop table in SQL\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table-1536x824.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table-520x279.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/drop-table-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Some of the Restrictions on Alter table are as follows:<\/strong><\/p>\n<ul>\n<li>By using an alter table, we can\u2019t change the name of the table.<\/li>\n<li>We can\u2019t modify the names of the columns.<\/li>\n<li>We can&#8217;t alter a column already containing data.<\/li>\n<\/ul>\n<h3>Summary<\/h3>\n<p>Thus, we have seen the alter and the truncate command in SQL. We use the alter command for multiple functionalities i.e., to add columns, modify columns, and many more.<\/p>\n<p>With these commands, we can easily modify our database. We need to be very attentive while truncating the data as once a database point strikeout, we can\u2019t recover it back.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL provides us with the flexibility to modify and delete a table after it\u2019s creation. We have data that needs to be put in the table and, at the same time, data that is&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":86880,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[429,434,435,437,438,4250,4366,13400,13579,14041,14106,14971,15171],"class_list":["post-23628","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","tag-alter-command-in-sql","tag-alter-table-add-column-mysql","tag-alter-table-add-column-oracle","tag-alter-table-add-multiple-columns","tag-alter-table-command-in-sql","tag-example-of-alter-command-in-sql","tag-example-of-truncate-table-in-sql","tag-sql-add-column-with-default","tag-sql-truncate","tag-syntax-of-alter-table-command-in-sql","tag-syntax-of-sql-truncate-table-command","tag-truncate-table-in-sql","tag-update-command-in-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Alter Command In SQL | Truncate Table In SQL - DataFlair<\/title>\n<meta name=\"description\" content=\"Alter Command in SQL, syntax and example of SQL Alter Table Command, Truncate Table in SQL, SQL drop table,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Alter Command In SQL | Truncate Table In SQL - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Alter Command in SQL, syntax and example of SQL Alter Table Command, Truncate Table in SQL, SQL drop table,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-13T06:29:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-10T16:23:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Alter-Command-Truncate-Command.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Alter Command In SQL | Truncate Table In SQL - DataFlair","description":"Alter Command in SQL, syntax and example of SQL Alter Table Command, Truncate Table in SQL, SQL drop table,","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:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/","og_locale":"en_US","og_type":"article","og_title":"Alter Command In SQL | Truncate Table In SQL - DataFlair","og_description":"Alter Command in SQL, syntax and example of SQL Alter Table Command, Truncate Table in SQL, SQL drop table,","og_url":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-08-13T06:29:06+00:00","article_modified_time":"2021-03-10T16:23:25+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Alter-Command-Truncate-Command.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Alter Command In SQL | Truncate Table In SQL","datePublished":"2018-08-13T06:29:06+00:00","dateModified":"2021-03-10T16:23:25+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/"},"wordCount":607,"commentCount":4,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Alter-Command-Truncate-Command.jpg","keywords":["Alter command in SQL","alter table add column mysql","alter table add column oracle","alter table add multiple columns","Alter Table Command in SQL","Example of Alter Command in SQL","Example of Truncate Table in SQL","sql add column with default","SQL Truncate","Syntax of Alter Table Command in SQL","syntax of SQL Truncate table command","Truncate Table In SQL","update command in SQL"],"articleSection":["SQL Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/","url":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/","name":"Alter Command In SQL | Truncate Table In SQL - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Alter-Command-Truncate-Command.jpg","datePublished":"2018-08-13T06:29:06+00:00","dateModified":"2021-03-10T16:23:25+00:00","description":"Alter Command in SQL, syntax and example of SQL Alter Table Command, Truncate Table in SQL, SQL drop table,","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Alter-Command-Truncate-Command.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Alter-Command-Truncate-Command.jpg","width":1200,"height":628,"caption":"Alter Command & Truncate Command in SQL"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/alter-command-in-sql-truncate\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Searching for Groups of Scala Regex","item":"https:\/\/data-flair.training\/blogs\/tag\/searching-for-groups-of-scala-regex\/"},{"@type":"ListItem","position":3,"name":"Alter Command In SQL | Truncate Table In SQL"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/23628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=23628"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/23628\/revisions"}],"predecessor-version":[{"id":86891,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/23628\/revisions\/86891"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/86880"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=23628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=23628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=23628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}