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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.