How to Create a Schema
Create the Schema Definition File
The first thing to do with the RDM system is to design and create a schema for the database. The simplest way to do this is to open an empty document and type the SQL keywords to create the database then the tables for the schema.
If using SQL or our rdm-sql
tool to create your schema, the first line will always be:create database DATABASE_NAME;
where DATABASE_NAME
is the desired name for the database.
The table names in the following format:
create table TABLE_NAME (
where TABLE_NAME
is the desired name for the first table. From there, you be decided the columns you want in the table of the format:
COLUMN_NAME columnType,
where COLUMN_NAME
is the desired name for that column and columnType
is one of the supported types of RDM. Those supported types can be found in the Data Types section.
Once you have defined all the columns, you end the last line as:
COLUMN_NAME columnType );
This completes your table definition and you can repeat the process again for any further tables you want in your database.
Example schema:
create table author( last_name char(13) primary key, full_name char(35), gender char(1), yr_born smallint, yr_died smallint, short_bio varchar(216), ); create table book( bookid char(14) primary key, last_name char(13) references author, title varchar(105) key, descr char(61), publisher varchar(136), publ_year smallint key, date_acqd date, price decimal(10,2), cost decimal(10,2) );
For more information about the database schema capabilities, refer to the Defining a Schema section of the DDL User Guide.
Next Steps
The Database Creation section explores how to create a database using the schema created above.