1.FIRST 5 C IN CURRENT_SALARY
SORTED BY DESCENDING SALARY_AMOUNT IN C
You can use FIRST and SORTED BY clauses to find the maximum
values for a field. In this example, the FIRST clause finds the
five highest paid employees.
2.E IN EMPLOYEES
In this example, the RELATION clause retrieves all records from
the EMPLOYEES relation.
3.COUNT OF E IN EMPLOYEES WITH STATE IN E = "NY"
In this example, the RELATION clause declares E as the context
variable for the stream of records from the EMPLOYEES relation.
4.E IN EMPLOYEES CROSS JH IN JOB_HISTORY
WITH EMP_ID IN E = EMP_ID IN JH
In this example, the CROSS clause finds all employees for whom
data is stored in the JOB_HISTORY relation.
5.E IN EMPLOYEES CROSS J IN JOBS
In this example, the CROSS clause retrieves information on all
employees and their job descriptions.
6.E IN EMPLOYEES WITH JOB_CODE IN E = "R"
In this example, the WITH clause returns all employees whose
JOB_CODE equals R.
7.REDUCED TO JOB_CODE IN J
In this example, the REDUCED clause lists all active job codes
once.
8.EMPLOYEES SORTED BY EMPLOYEE_ID IN E
In this clause, the SORTED BY clause sorts EMPLOYEES by
EMPLOYEE_ID.
9.SORTED BY DESCENDING STATUS_CODE IN E
ASCENDING LAST_NAME IN E, EMPLOYEE_ID IN E
In this example, the SORTED BY clause sorts first by STATUS_
CODE in descending order. Within each STATUS_CODE group, SORTED
BY sorts by LAST_NAME in ascending order. Finally, within
groups of employees with the same last name, SORTED BY sorts
by EMPLOYEE_ID. The order for this last sort is also ascending,
because it adopts the order from the previous sort key.