Modifying Table Structures with the ALTER TABLE Statement

Many times your database design does not account for everything it should. Also, requirements for applications and databases are always subject to change. The ALTER TABLE statement enables the database administrator or designer to change the structure of a table after it has been created.

The ALTER TABLE command is a powerful feature in SQL that enables you to modify the structure of a table after it has been created. Without the ALTER TABLE command, you would have to drop a table and re-create it every time you wanted to make a change to its structure. This section discusses two of the main features of the ALTER TABLE command:

  • Adding a column to an existing table

  • Modifying an existing ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.