In MySQL, the SQL syntax forALTER TABLE Drop Column is
ALTER TABLE "table_name"
DROP "column 1"
In Oracle and SQL Server, the SQL syntax for ALTER TABLE Drop Column is
ALTER TABLE "table_name"
DROP COLUMN "column 1"
Let's look at the example. Assuming our starting point is the "customer" table created in the CREATE TABLEsection:
Table customer
Column Name | Data Type |
First_Name | char(50) |
Last_Name | char(50) |
Address | char(50) |
City | char(50) |
Country | char(25) |
Birth_Date | date |
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;
Resulting table structure:
Table customer
Column Name | Data Type |
First_Name | char(50) |
Last_Name | char(50) |
Address | char(50) |
City | char(50) |
Country | char(25) |
0 comments:
Post a Comment