ALTER TABLE Statement Example

This example adds a Salary field with a data type of Currency to the Employees table.

ALTER TABLE Employees ADD COLUMN Salary CURRENCY;

This example removes the Salary field from the Employees table.

ALTER TABLE Employees DROP COLUMN Salary;

This example adds a foreign key to the Orders table. The foreign key is based on the EmployeeID field and refers to the EmployeeID field of the Employees table. In this example, you don't have to list the EmployeeID field after the Employees table in the REFERENCES clause because EmployeeID is the primary key of the Employees table.

ALTER TABLE Orders ADD CONSTRAINT OrdersRelationship FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID);

This example removes the foreign key from the Orders table.

ALTER TABLE Orders DROP CONSTRAINT OrdersRelationship;