The command in the SQL statement to modify the table structure is ALTER TABLE.
ALTER TABLE statement
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
SQL ALTER TABLE syntax
To add columns to the table, please use the following syntax:
ALTER TABLE table_name ADD column_name datatype
To delete columns in the table, please use the following syntax (Please note that some database systems do not allow this way of deleting columns in database tables):
ALTER TABLE table_name DROP COLUMN column_name
To change the data type of a column in a table, use the following syntax:
SQL Server / MS Access:
ALTER TABLE table_name ALTER COLUMN column_name datatype
My SQL / Oracle:
ALTER TABLE table_name MODIFY COLUMN column_name datatype
Oracle 10G and later versions:
ALTER TABLE table_name MODIFY column_name datatype;
For more SQL-related technical articles, please visit SQL tutorial column to learn!
The above is the detailed content of What is the command to modify the table structure in sql statement?. For more information, please follow other related articles on the PHP Chinese website!