1 :Info: mrds.selection_expr.gi: mrds.selection_expressions:  1980-05-15  mrds.selection_expressions
 2 
 3 This info segment briefly describes the MRDS database query language,
 4 which is normally referred to as a selection expression.
 5 
 6 
 7 Syntax:
 8 -range (tuple_variable1 relation_name1) {... (tuple_variableN relation_nameN)}
 9 -select tuple_variable1.attr_name1 {... tuple_variable1.attr_nameN}
10                                         .
11                                         .
12         tuple_variableN.attr_name1 {... tuple_variableN.attr_name}
13 {-where {(((...} tuple_variable1.attr_name = tuple_variable2.attr_name { )  &
14                                         .
15                                         .
16                 tuple_variableN-1.attr_name = tuple_variableN.attr_name) } }
17 
18 
19 Semantics:
20 The range clause specifies which relations in the database will be
21 involved in this query, and associates a tuple variable with each
22 relation.  There may be more than one tuple variable, if need be, per
23 relation.
24 
25 The select clause specifies which attributes, in which relations, are
26 to be selected, upon satisfaction of the where clause conditions.  If
27 only a tuple_variable is given, then all attributes in the
28 corresponding relation are selected.
29 
30 
31 The where clause specifies under what conditions, data is to be
32 selected from the database.  It is more general than shown above:
33 
34   The = could be any of =, ^=, <, >, <=, >=.
35   The & connector could have been |.
36   A whole expression could have been negated by ^(expression).
37 
38   The comparisons can be against not only other tuple variable
39   qualified attributes, but constants and expressions involving the
40   arithmetic operators +, -, /, and *, as well as mrds builtin or
41   user defined functions.  Such expressions are enclosed in brackets,
42   as in [tuple_variable.attr_name + 2], and can involve only one
43   tuple variable per expression.
44 
45 
46   Values can be substitued in place of a constant in the selection
47   expression string, in the where clause comparisons, by using the
48   symbol .V. in place of the constant, and then in the subroutine
49   call, using a se_value in the argument list.
50 
51   Complicated where clauses can be built using parentheses for ordering
52   of the evaluation.
53 
54 
55 The where clause is optional, and if not given, all tuples in the
56 range are selected.
57 
58 See the help file mrds.builtins.info.
59 
60 
61 Exceptions:
62 The range clause can have a .V.  argument substitution in place of a
63 relation name, in order to make use of a temporary relation index
64 (not a relation name).  The range clause may also have an option
65 added after -range.  These options are -print_search_order (-pso),
66 and -no_optimize (-no_ot).  They can be used to determine or produce
67 an optimal data access search procedure.
68 
69 The select clause can have a -dup specified, to indicated that
70 retrieved duplicates are not to be eliminated, which can improve
71 efficiency, but can not be used with set operations.
72 
73 The select clause can have an asterisk following a attribute name,
74 when defining a temporary relation, in order to specify a key
75 attribute for the temporary relation.
76 
77 
78 Individual selection expressions can be combined using set
79 operations, for retrieves, when the results of each are union
80 compatible results.  The syntax is (se) set_op (se).  Set_op may be
81 one of -inter, -union, or -differ for set intersection, union, or
82 difference.  These set operations may be nested using parenthesis.
83 
84 When doing retrieves, the entire selection expression may be replaced
85 by "-another" to retrieve subsequent tuples satisfying the selection
86 expression that found the first tuple.
87 
88 Similarily, "-current tuple_variable1.attr_name 1 ...
89 tuple_variable1.attr_nameN" can be used to reselect the same tuple
90 previously selected, and is useful in conjunction with modifies and
91 deletions, done after retrieves using -another.
92 
93 
94 :hcom:
95 /****^  HISTORY COMMENTS:
96   1) change(2020-12-15,GDixon), approve(2021-02-22,MCR10088),
97      audit(2021-05-27,Swenson), install(2021-05-27,MR12.6g-0056):
98       A) Fix errors reported by the new verify_info command.
99                                                    END HISTORY COMMENTS */