Altering table definitions

You want to add a column to table foo.

Solution

Either:

1. Create a new table bar with the additional field, copy the data over then delete foo and rename bar

2. Use the ALTER TABLE ADD COLUMN command

The first has the advantage that you can make more radical changes than just adding a column. The second is much quicker ref.

Discussion

Even the best design needs occasional tweaking. To add a city column to the companies table you would use

ALTER TABLE companies ADD COLUMN city(text);
   

You can also add indices and constraints to a table, rename columns or change the owner of a table. If you find something you can't do just follow solution 1.