|
In MySQL, the SQL syntax for ALTER 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 TABLE section:
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) |
ALTER TABLE ADD INDEX >>
Link to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.
Copyright © 2012 1keydata.com All Rights Reserved.
Privacy Policy
|