Write code to alter table definitions.
Writing code should include using the alteration of a previously created table and using syntax such as the following:
ALTER TABLE employees
ADD CONSTRAINT emp_manager_fk
The ALTER TABLE command is a DDL command, which means that it is automatically committed to the database when issued. Guidelines for altering the structure of a table is as follows:
- Add, drop, enable, or disable a constraint without the ability to modify its structure.
- Add a NOT NULL constraint to an existing column by using the MODIFY clause of the ALTER TABLE statement.
- Define a NOT NULL column only if the table is empty or if the column has a value for every row.