next up previous contents index
Next: SQL commands Up: An Introduction to Using Previous: How to Make a

Using More Than One Ingres Table

 

LOCUS lets you look at parameters from more than one parameter table. When more than one parameter table is used, you must either supply a key or keys which are used to join  the tables or you can specify the join explicitly . For example, to use two parameter tables TESCAL and TOK with records joined on shot number, do:

   <0=SD;> Select database and tables <DB>:  PT
   <1=GT;> Tables <>:                        TESCAL TOK ;

   <0=SD;> Select database and tables <DB>:  RETURN
   \* Options are:
    1) DB  Database           MURPHY
    2) PT  Parameter  Tables  TESCAL  TOK
    3) PA  Parameter  Aliases A       B
    4) PK  Parameter  Keys

   <0=SD;> Select database and tables <PT>:  PK
   <1;> Keys for TESCAL? < >:                SHOT ;
   <1;> Keys for TOK? < >:                   SHOT ;
The tables will be joined on SHOT such that A.SHOT=B.SHOT when a retrieval requires parameters from more than one table. This may have the effect of a constraint since there may be shots in one table, but not the other. The join on the specified parameter keys is only applied if the retrieve requires columns from both tables.

Alternatively the join can be specified explicitly.

   <0=SD;> Select database and tables <PK>:          JO
   <1> Use the join instead of parameter keys? <N>:  Y
   <2;> Join? < >:                                   A.SHOT=B.SHOT
By specifying the join explicitly instead of using the PK option, you force the join to be applied for all retrieves. You would also specify the join explicitly if you have different keys in more than two tables. For example, if you have three tables where the first is a function of shot, the second of shot and radius, and the third table just contains a mapping of radius to frequency, you would specify the join as:
   <2;> Join? < >:          (A.SHOT=B.SHOT)and(B.RADIUS=C.RADIUS)
where a, b, and c are aliases for the three tables.



Marilee Thompson
Fri Jul 11 17:05:56 EDT 1997