AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
SQL Drop Column Syntax |
SQL > ALTER TABLE >
Drop Column Syntax
Sometimes we will wish to delete a column from an existing table in SQL. To do this, we specify that we want to change the table structure via the ALTER TABLE command, followed by a specification indicating that we want to remove a column. The detailed syntax for each database is as follow: In MySQL, the syntax for ALTER TABLE Drop Column is, ALTER TABLE "table_name"
DROP "column_name"; In Oracle, SQL Server, and Google BigQuery, the syntax for ALTER TABLE Drop Column is, ALTER TABLE "table_name"
DROP COLUMN "column_name"; Let's look at the example. Assuming our starting point is the Customer table created in the CREATE TABLE section: Table Customer
Our goal is to drop the "Birth_Date" column. To do this, we key in: MySQL:
ALTER TABLE Customer DROP Birth_Date;
SQL Server:
ALTER TABLE Customer DROP COLUMN Birth_Date;
Oracle:
ALTER TABLE Customer DROP COLUMN Birth_Date;
Google BigQuery:
ALTER TABLE Customer DROP COLUMN Birth_Date;
The resulting table structure is: Table Customer
|
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.