By default, the query sorts objects using sorting criteria, which is described in Sorting and grouping.
If you don't specify a query expression using query-related options or a query_string argument, the command shows the current selection set and applies any sorting, then updates the selection set.
To use a query function that provides sorting (for example, recursive_is_member_of ), the query function's sorting order is applied to the final displayed result if -no_sort is specified, and if that query function is not combined with other query operators to make a compound query.
Selection set ordering and use
By default, the output is numbered to show the selection set reference number. You can then reference specific objects in the selection set by using the selection set reference syntax (for example, @1). See Query selection set reference form for details.
The command supports a number of options for constructing a query expression. For example, the -name option provides an alternative way of constructing a query clause of the type name='name'.
If such an option is repeated, the corresponding query clauses are combined with an or. For example, -n joe -n ann results in a query clause (name='joe' or name='ann').
Query clauses for different options are combined with an and. For example, -n joe -s working results in a query clause (name='joe') and (status='working').
These constructed query clauses are combined with any specified query_string argument with an and. For example, -n joe "is_hist_leaf()" results in a query expression of (name='joe') and (is_hist_leaf()).
The query command supports the Querying for objects or showing the query selection set subcommand.