Saturday 6 October 2012

Modifying table structures

The ALTER statement can be used in a variety of ways to modify the table structure. It can be used to modify, add, and delete columns. Alter can also be used to change a table's name.

Format
Add an attribute
ALTER TABLE table ADD new_attribute data Type <properties>'

Delete an entire attribute(column) from table
ALTER TABLE table DROP COLUMN attribute;

Edit type and property existing attribute(Not available in Microsoft Access)
ALTER TABLE table MODIFY attribute data type <properties>;

Rename a table (Not available in Microsoft Access)
ALTER TABLE table RENAME TO <new name>;

No comments:

Post a Comment