Change table Declaration
Alter table statements are used to add, delete, or modify columns in an existing TABLE.
Database alter table syntax
To add a column to a table, use the following syntax:
Alter table table_name ADD column_name datatype
To delete a COLUMN in a TABLE, use the following syntax (notification, some database systems cannot delete a COLUMN): alter table table_name drop column column_name
To change the data type of a COLUMN in a TABLE, use the following syntax: alter table table_name alter column column_name datatype
Now let's take a look at the use of SQL drop.
SQL DROP INDEX, DROP TABLE, and DROP DATABASE
Indicators, tables, and databases can be easily deleted/removed from the same drop-down statement. The index drop statement indicates that the index drop is used to delete the index table. Drop index syntax for MS Access: drop index index_name ON table_name
The drop index syntax is ms SQL Server:
Drop index table_name.index_name
Drop index Syntax for DB2/Oracle:
Drop index index_name
Drop index Syntax for MySQL: alter table table_name drop index index_name
Use drop to delete a table as follows.
Drop table table_name
Use drop database.
Drop database database_name
What if we only want to delete the data table, not the table itself? Then, use the truncation TABLE statement