[Figure: Relationships among the STOCK table, ORDER table, and COMPANY table]
2.3 Creating a Database
This section contains the following topics to explain how to create databases:
· Defining a database by using the rdbddlex command
· Defining a database from an application program
2.3.1 Defining a database by using the rdbddlex command
This section shows how to create databases from a definition file.
Physical, logical, and storage structures can be defined using the rdbddlex command.
The first step is to create an input file to be used by the rdbddlex command. The next step is to execute the rdbddlex
command.
The d option of the rdbddlex command can only be omitted if the first SQL statement of the definition file is the
CREATE DATABASE statement.
Input file format of rdbddlex command
The syntax of for describing an input file of the rdbddlex command has the following general formats:
Format 1
Specify a semicolon (;) to terminate each SQL statement.
Format 2 (Format for defining a procedure routine)
To define a procedure routine, prefix the input file with "EXEC SQL" and suffix it with "END-EXEC;". The data between
"EXEC SQL" and "END-EXEC;" is assumed to be an SQL statement. This format is only valid if the x option has been
specified in the rdbddlex command.
21