a
 
SQLRef.Com 

            SqlRef.Com


SQL BASIC
DATA QUERY LANGUAGE
BASIC FUNCTION
AGGREGATE FUNCTION
DATA MANIPULATION LANGUAGE
DATA DEFINITION LANGUAGE
DATA CONTROL LANGUAGE
OTHERS

ALTER TABLE

You can change the table structure with the ALTER TABLE command. You may use ALTER TABLE to change the table by adding, changing or deleting a column in the table.

Table: Employee

EmployeeID FirstName LastName Street City State Zipcode Phone
               
               

You can use the following SQL statement add Street2 field to the Employee table.

ALTER TABLE Employee ADD COLUMN Street2 CHAR (30)

After executing the above command, the Employee table will looks like the following table.

Table: Employee

EmployeeID FirstName LastName Street Street2 City State Zipcode Phone
                 
                 

Besides adding column, you can also use ALTER TABLE to remove field from a table. You can use the following SQL statement to remove Phone field from Employee table.

ALTER TABLE Employee DROP COLUMN Phone

After executing the above SQL statement, the Employee table will looks like the following.

Table: Employee

EmployeeID FirstName LastName Street Street2 City State Zipcode
               
               
.



 
| Freebies | Free Trial | Add to Bookmark | Search | Link to Us |
Copyright © 2006 SqlRef.com. All rights reserved.