Products Support Documentation Download
Database Definition Language (DDL) Reference

A poorly designed database can create all kinds of difficulties for the user of a database application. Unfortunately, the blame for those difficulties is often laid at the feet of the database management system which, try as it might, simply cannot use non-existent access paths to quickly get at the needed data. Good database design is as much of an art as it is engineering and a solid understanding of the application requirements is a necessary prerequisite. However, it is not the purpose of this document to teach you how to produce good database designs. But you do need to understand that designing a database is a complex task and that the quality of the application in which it is to be used is highly dependent on the quality of the database design. If you are not experienced in designing databases then it is highly recommended that you first consult any number of good books on that subject before setting out to develop your RDM database.

A database schema is the definition of what kind of data is to be stored and how that data is to be organized in the database. RDM databases are defined using the Database Definition Language (DDL) specified by the ISO/ANSI SQL Standard. Even if you intend to only use the RDM native (non-SQL) API to access and manipulate your database data, you still need to use the RDM DDL that is based on the SQL standard to define your database schema.

Your initial database definition will consist of at least one or more create table statements and any create domain statements used to name your own data types used in the table definitions.

If you are issuing your DDL statements through an SQL interface to RDM then the first DDL statement must be the create database statement in order to identify the name the database is to have. Also note that DDL statements submitted through SQL are transactional—a commit statement must be executed in order to make the database definition permanent.

If you are submitting your DDL through either of the two RDM utilities rdm-compile or rdm-create, then the database name is derived from the name of the text file that contains your DDL specification (the create database statement is not recognized in this context). DDL statements issued through either of these two utilities are not transactional. The database definition becomes permanent once the utility successfully completes.

Once a database has been defined and populated with data, changes to the DDL can be made through a variety of DDL statements. New domains and tables can be added using create domain and create table. Existing tables can be changed using alter table. New keys (indexes) can be added using either the alter table statement or the create index statement. Domains and tables can be deleted from the database using the drop domain or drop table statements. If you are submitting your DDL statements that dynamically alter the definition of the database through SQL then you can issue an alter database statement to identify the database to be changed however that is not required if the database is already open.