#set TITLE = "Tables organized hierarchically"
#include top

.SH Tables organized hierarchically
.LP
Hierarchical structures are sometimes useful.  To accomodate this,
\fBshsql\fR allows for collections of data tables to be organized hierarchically.
The tables in the hierarchy can all share the same format, or have different formats.
See also the
#set FILE = "tabletypes.html"
#set TAG = "shsql table types chart."
#include link
.LP
A hierarchy is created by making a subdirectory in the database \fCdata\fR directory.
Data table files can then be created in the subdirectory using
#set FILE = "create.html#table"
#set TAG = "CREATE TABLE."
#include link
Table names are relative to the \fCdata\fR directory.
For example, after you make a directory in your \fCdata\fR directory called
\fCcases\fR, you can issue this CREATE command:
.nf
	create table cases/2002_03 ( field1, field2 .. fieldn )
.fi
.LP
These data files may be referenced similarly in SQL
\fCSELECT\fR, \fCINSERT\fR, \fCDELETE\fR, and \fCUPDATE\fR commands, like this: 
.LP
\fCselect * from cases/2002_03\fR
.LP
To concatenate multiple files from the hierarchy together for treatment as a single table, 
#set FILE = "createstream"
#set TAG = "CREATE STREAM"
#include link
can be used along with
#set FILE = "dbcat.1.html"
#set TAG = "dbcat(1)."
#include link

#include space

.SH Example
An example of a hierarchical collection of tables is included in \fCsqlexampledb\fR.
See \fCtestruns/README\fR.

#include bottom

