Schema Changes

Ingres does not provide a simple means of changing table definitions. Column names and data types cannot be altered. If you wish to do so you must create a new table containing the required changes.

If the new table can have a different name then you need to create a newly defined table, transfer any data from the old table to the new, and then destroy the old table.

If the new table must have the same name as the old one (due to application constraints), then the process involves dropping(deleting) the existing table, and then creating the new table. Should your table contain any data you will need to copy this out into an ASCII file before destroying it. The data in this file can then be copied into your new table provided that it has suitable data types and formats.

When you destroy a table, you also destroy any Primary & Secondary Indexes that might have been specified. These will need to be recreated once the new table has been defined.

It is for these reasons that it is easier to create tables through SQL. A file containing the necessary SQL commands(scripts) to perform the whole process, may be executed in one go. This is far easier than carrying out the procedure through the TABLES utility.

Exercise 5 - Do this now.


This WWW material is copyright De Montfort University and may only be reproduced or used if this copyright notice is included.
This page is maintained by John Skelton. Comments or suggestions for improving this material can be emailed to jas@dmu.ac.uk) and will be gratefully received.