QUEL Reference Guide > QUEL Reference Guide > QUEL and EQUEL Statements > RANGE--Associate Range Variables with Tables
Was this helpful?
RANGE--Associate Range Variables with Tables
Valid in: QUEL, EQUEL
Associates a range variable with a table.
This statement has the following format:
[##] range of range_var is tablename {, range_var is tablename}
A range statement associates a range variable with the table or view specified by tablename. A range declaration remains in effect until:
The session ends, or
The variable is redeclared by another range statement, or
Its table or view definition is destroyed
Not all range variables are declared using the range statement: the table name you specify in a retrieve statement is considered to be an implicit or default range variable.
Range variables enable you to treat the same table as though it were two separate tables. In the following example, range variables "e" and "m" allow you to extract employees and their managers from the same table.
range of d is dept
range of e is employee
range of m is employee
retrieve (e.ename, mgr=m.ename)
where e.dept=d.dno and d.mgr=m.eno
Last modified date: 06/08/2023