- Database Schema Definition
The DDL (Database Definition Language) specification for the database used in this example is located in the file core06_db.sdl
.
/*
* EXAMPLE - Core04 for C
*
* This is the DDL (Database Definition Language) for a database implementing
* two one-to-many relationship using network model sets. The database will
* implement the beginnings of an mp3 collection. The one (owner) side
* of the relationship is an artist records. The many (member) side of the
* relationship is the album record. There will be a second set where the one
* side is the album record and the many side is a track record.
* The artist name and album title will be index so they can be retrieved in
* sorted order. The index will also allow an application to preform an
* efficient search on those fields.
*/
create table artist
(
artistid rowid primary key,
name char(100) key not null
);
create table album
(
albumid rowid primary key,
artistid rowid references artist(artistid),
title char(100) key not null
);
create table track
(
albumid rowid references album(albumid),
title char(100) not null
);
The schema was compiled using the RDM rdm-compile utility with the -s option to generate C-structures for interfacing with the database.
rdm-compile -s core06_db.sdl