Mark As Completed Discussion

ALTER

1. ALTER TABLE

The DDL command ALTER is used to change the structure of the databases we create. For example, you might want to be able to keep track of inventory with your new database. You decide to add a column called qty_on hand.

TEXT/X-SQL
1ALTER TABLE albums
2ADD qty_on_hand SMALLINT NOT NULL;

Or you notice that the data type you entered for album_id is an integer, when you actually wanted it to be a VARCHAR of length 3.

TEXT/X-SQL
1ALTER TABLE albums
2MODIFY COLUMN album_id VARCHAR(3);