In SQL, use the ALTER TABLE statement to delete a column. The syntax is: ALTER TABLE table_name DROP COLUMN column_name; the steps include: ① Specify the table name of the column to be deleted; ② Use the DROP COLUMN clause to specify the column to be deleted. Column name; ③ Execute statement. For example, to delete the email column in the customers table, the statement is: ALTER TABLE customers DROP COLUMN email; deleting a column is an irreversible operation and may affect the constraints and indexes of other columns.
Command to delete a column in SQL
In SQL, you can use ALTER TABLE
statement to delete a column in a table. The syntax of this statement is as follows:
<code>ALTER TABLE table_name DROP COLUMN column_name;</code>
Among them, table_name
is the table name of the column to be deleted, and column_name
is the name of the column to be deleted.
Steps:
ALTER TABLE
statement The table name of the column. DROP COLUMN
clause to specify the column name to be deleted. ALTER TABLE
statement to delete the column. Example:
The following example deletes the email
column in the customers
table:
<code>ALTER TABLE customers DROP COLUMN email;</code>
Note:
The above is the detailed content of Command to delete a column in sql. For more information, please follow other related articles on the PHP Chinese website!