SQL database system
 
Manual page for Tables(organized)

Tables organized hierarchically

Hierarchical structures are sometimes useful. To accomodate this, shsql 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 shsql table types chart.

A hierarchy is created by making a subdirectory in the database data directory. Data table files can then be created in the subdirectory using CREATE TABLE. Table names are relative to the data directory. For example, after you make a directory in your data directory called cases, you can issue this CREATE command:

	create table cases/2002_03 ( field1, field2 .. fieldn )

These data files may be referenced similarly in SQL SELECT, INSERT, DELETE, and UPDATE commands, like this:

select * from cases/2002_03

To concatenate multiple files from the hierarchy together for treatment as a single table, CREATE STREAM can be used along with dbcat(1).


Example

An example of a hierarchical collection of tables is included in sqlexampledb. See testruns/README.


Copyright Steve Grubb  


Markup created by unroff 1.0,    March 18, 2004.