Please visit our sponsors !
SQL Alter Table
Alter Table
The ALTER TABLE statement is used to add or drop columns in an existing
table.
ALTER TABLE table_name
ADD column_name datatype
ALTER TABLE table_name
DROP COLUMN column_name
|
Note: Some database systems don't allow the dropping of a column in a
database table (DROP COLUMN column_name).
Person:
LastName |
FirstName |
Address |
Pettersen |
Kari |
Storgt 20 |
Example
To add a column named "City" in the "Person" table:
ALTER TABLE Person ADD City varchar(30)
|
Result:
LastName |
FirstName |
Address |
City |
Pettersen |
Kari |
Storgt 20 |
|
Example
To drop the "Address" column in the "Person" table:
ALTER TABLE Person DROP COLUMN Address
|
Result:
LastName |
FirstName |
City |
Pettersen |
Kari |
|
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|