Update TABLE: ALTER, DROP, MODIFY

--- ALTER TABLE TO  MODIFY A COLUMN

--- DROP A COLUMN
ALTER TABLE TBL_EMPLOYEE DROP COLUMN Department;

Add a Column

ALTER TABLE TBL_DEPARTMENT

ADD DEPARTMENT_HEAD VARCHAR(20 CHAR);

Drop a Column

-- Assuming you have a table named "your_table" and you want to delete a column named "column_to_delete"
ALTER TABLE your_table
DROP COLUMN column_to_delete;

DROP Multiple Columns

Make Table UNUSED: This is a temporary alternative to dropping a table

DROP UNUSED FIELDS

Add a Constraint to a Table

Text description of out_of_line_constraint.gif follows

ALTER TABLE TBL_TRANSACTION
ADD CONSTRAINT uniq_TRANSACTION UNIQUE (AMOUNT, DATE_OF_TRANSACTION, EMPLOYEE_NUMBER);

Temporarily Disable a Constraint

ALTER TABLE TBL_TRANSACTION
DISABLE CONSTRAINT uniq_TRANSACTION ;

Enable  a Constraint

ALTER TABLE TBL_TRANSACTION
enable CONSTRAINT uniq_TRANSACTION ;

Update TAble

Constrainsts can also be added when the table is being created. Click here to see how.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top