
Database Development and Management with SQL ◾ 133
ALTER TABLE SHIPPING ADD
CONSTRAINT Shipping_EmployeeID_fk
FOREIGN KEY (EmployeeID)
REFERENCES EMPLOYEE (EmployeeID)
To add a check constraint to the column Qoh in the INVENTORY table, use
ALTER TABLE INVENTORY ADD
CONSTRAINT Inventory_ck CHECK(Qoh >= 0)
With the ALTER TABLE constraint, you can also add and delete columns in a table. For
example, if you want to add a column ShelfID to the table INVENTORY, use the following
code:
ALTER TABLE INVENTORY ADD ShelfID INT
You can also delete the column ShelfID from the table INVENTORY with the following
code:
ALTER TABLE INVENTORY Drop COLUMN ...