Fujitsu J2X0-2273-01EN User Manual

Page of 225
 
 
Adding a table definition (CREATE TABLE statement)
 
To add a table definition to a schema, use the CREATE TABLE statement. A specification example follows. For details 
about how to specify the CREATE TABLE statement, see 2.6 "Defining a Logical Structure." 
Example: 
Add a definition of the PRODUCT table to the schema named STOCKS. 
 
 
 
Deleting a table definition (DROP TABLE statement)
 
To delete a table definition, use the DROP TABLE statement. If a view table, procedure routine, function routine, or 
trigger references a base table, the table definition cannot be deleted. Delete the definition of the view table, 
procedure routine, function routine, or trigger that references the base table before deleting the table definition. To 
delete the view, procedure routine, function routine, or trigger definition that references a base table together with the 
table definition, specify CASCADE. Similarly, the CASCADE specification is required to delete any storage structure 
definition of a base table together with the table definition. 
When a table definition is deleted by the DROP TABLE statement, the base table database data is also deleted at the 
same time. If another table name is specified by mistake in the table definition, the definition information will be lost. 
Moreover, the important data will be lost as well. Be especially careful when using the DROP TABLE statement. 
An example of deleting a table definition follows. 
Example: 
Delete the STOCK table definition information and STOCK table. 
 
 
 
Altering a table definition (ALTER TABLE statement)
 
To alter a table definition, use the ALTER TABLE statement. The ALTER TABLE statement can be used to make the 
following changes: 
 
·  Add a column definition. 
 
·  Delete a column definition. 
Adding a column definition
 
To add a column to a base table, specify addition of a column definition in the ALTER TABLE statement. Only one 
column can be added at the end of the existing columns per table definition alter statement. For the SEQUENTIAL 
118