Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
alternatives | 2020-05-11 | 19.1 kB | |
bom.sql | 2020-05-11 | 4.8 kB | |
hier1.ace | 2020-05-11 | 3.1 kB | |
hier1.sh | 2020-05-11 | 4.5 kB | |
hier2.ace | 2020-05-11 | 499 Bytes | |
hier2.sh | 2020-05-11 | 3.6 kB | |
hier.sql | 2020-05-11 | 2.5 kB | |
Makefile | 2020-05-11 | 607 Bytes | |
partexp1.sh | 2020-05-11 | 1.6 kB | |
partexp2.sh | 2020-05-11 | 1.9 kB | |
partexp3.sh | 2020-05-11 | 2.3 kB | |
partexp4.sh | 2020-05-11 | 2.4 kB | |
pp.1.sh | 2020-05-11 | 774 Bytes | |
pp.sql | 2020-05-11 | 761 Bytes | |
README | 2020-05-11 | 2.0 kB | |
readme.txt | 2020-05-11 | 4.4 kB | |
Totals: 16 Items | 54.8 kB | 0 |
Examples in Hierarchical Data Structures ======================================== The accompanying shell scripts, ACE report and SQL files can be used to demonstrate how to handle hierarchical data structures (eg Bill of Materials or Organisation Chart) in SQL. The Bill of Materials (BoM) solutions (partexp1..partexp4) illustrate the use of Breadth-First-Search. The Organisation Chart (OC) solution (hier2) illustrates Depth-First-Search. Note that neither solution is neat and tidy, though the BoM is simply iterative whereas the OC solution requires a recursively defined table structure. The solutions use my program SQLCMD as an SQL command interpreter. The equivalent effect can more or less be achieved using either ISQL or DBACCESS, but it is not as easy, and some cases would require the output from ISQL/DBACCESS to be reformatted to retain the data one row per line. (Where the command is of the form sqlcmd -d dbase -e "SQL stmt", use echo "SQL stmt" | isql dbase -; where the command is of the form sqlcmd -d dbase -f file.sql, use isql dbase file; where the command is of the form sqlcmd -d dbase file1.sql file2.sql, use cat file1.sql file2.sql | isql dbase -; when -D is used, set DBDELIMITER to the argument value. When -F unload is used, change the last SELECT statement into an unload statement.) Contact me for source to SQLCMD. The Makefile has the targets all, dbase and runit. All makes the requisite files, dbase creates and loads the database, and runit runs the various programs. A sample output is included called runit.log. Note that both sets of data have random number sequences. The OC code was initially developed with a neat and tidy (non-random) sequence for the identifiers, and a neat and tidy solution was the result. When the numbers were randomised, that solution fell to bits, so the current hier2 solution was developed. Beware when adapting the code of this potential problem; simple sample data may easily mislead you. Jonathan Leffer Informix Software @(#)README 1.1 93/03/03