If you're particularly astute today, you might have noticed that we "accidentally" omitted one of the design requirements when implementing our database tables. XYZ Corporation's HR Director requested that the database track employee salary information and we neglected to provide for this in the database tables we created.
However, all is not lost. We can use the ALTER TABLE command to add this attribute to our existing database. We want to store the salary as an integer value. The syntax is quite similar to that of the CREATE TABLE command, here it is:
ALTER TABLE employeesNotice that we specified that NULL values are permitted for this attribute. In most cases there is no option when adding a column to an existing table. This is due to the fact that the table already contains rows with no entry for this attribute. Therefore, the DBMS automatically inserts a NULL value to fill the void.
ADD salary INTEGER NULL;
And that wraps up our look at the SQL database and table creation process. Check back often for new installments in our SQL tutorial series. If you'd like an e-mail reminder when new articles are added to the About Databases site, be sure to subscribe to our newsletter!

