SQL > ALTER TABLE

Once a table is created in the database, there are many occasions where one may wish to change the structure of the table. In general, the SQL syntax for ALTER TABLE is,

ALTER TABLE "table_name"
[alter specification];

[alter specification] is dependent on the type of alteration we wish to perform. We list a number of common changes below:

For all cases except Change Column, examples are provided for MySQL, Oracle, and SQL Server. SparkSQL and Hive SQL (HiveQL) only support Add Column and Change Column with ALTER TABLE.

Next: SQL ADD COLUMN

This page was last updated on October 11, 2024.




Copyright © 2024   1keydata.com   All Rights Reserved     Privacy Policy     About   Contact