You use DDL statements to define the structure and instances of a database. DDL provides statements for the definition and description of database objects.
The following table lists some basic DDL statements. The list is not exhaustive.
Statement |
Action |
CREATE |
Defines a new database object, such as a database, user, table, view, trigger, index, macro, stored procedure, user-defined type, user-defined function, or user-defined macro, depending on the object of the CREATE request. |
DROP |
Removes a database object, such as a database, user, table, view, trigger, index, macro, stored procedure, user-defined type, user-defined function, user-defined method, depending on the object of the DROP request. |
ALTER |
Changes, for example, a table, column, referential constraint, trigger, or index. |
ALTER PROCEDURE |
Recompiles an external stored procedure. |
MODIFY |
Changes a database or user definition. |
RENAME |
Changes, for example, the names of tables, triggers, views, stored procedures, and macros. |
REPLACE |
Replaces, for example, macros, triggers, stored procedures, and views |
SET |
Specifies, for example, time zones, the collation or character set for a session. |
COLLECT |
Collects optimizer or QCD statistics on, for example, a column, group of columns, index. |
DATABASE |
Specifies a default database. |
COMMENT |
Inserts or retrieves a text comment for a database object. |
Successful execution of a DDL statement automatically creates, updates, or removes entries in the Data Dictionary. For information about the contents of the Data Dictionary, see Chapter 13: “The Data Dictionary.”