Keeps (retains) some components in a result set while discarding others.


KEEP «component»



The name of a component found among the objects declared in a set specification. Any number of components can be specified, provided they appear among the declared objects.


In certain instances, you want to select records from several objects based on their relationships, but to keep data from only some of those objects. The KEEP subcommand enables you to specify the components whose data is to be kept in the result set.

The specified components of the set specification are kept. Components not kept are discarded, and duplicate records are removed from the set being specified.


find all Employees WorkIn Department \
  where LastName = "Jones" keep Departments

The department information is kept; all other components are discarded. If the KEEP subcommand were omitted, department information would be repeated for any department where more than one employee named Jones works.


Related Topics