Skip to content
Developer Edition runs on one host and does not require a product license file. Need multi-host deployment or performance testing at scale? Explore Enterprise Edition

YIELD clause

The YIELD clause selects columns to be used by subsequent statements, or renames those columns.

Syntax

yield_clause
YIELD yield_item_name AS variable , yield_item_name AS variable

yield_clause ::=
    'YIELD' yield_item_name ( 'AS' variable )? ( ',' yield_item_name ( 'AS' variable )? )*

Parameters

yield_item_name

The name of the selected column.

variable

The alias for the selected column. variable can be a regular identifier or a delimited identifier enclosed with backticks (`). For more information about identifiers, see Rules for naming identifiers.

Examples

Select and rename columns

'''
CALL show_graphs() YIELD graph_type, name AS graph_name 
RETURN graph_type, graph_name
'''

The preceding statement performs the following operations:

  1. Calls the procedure show_graphs() to obtain information about graphs. For more information, see CALL procedures.
  2. Selects the columns graph_type and name using the YIELD clause, and renames the column name to graph_name.
  3. Returns the columns graph_type and graph_name.

Return:

+--------------+------------+
| graph_type   | graph_name |
+--------------+------------+
| movie_type   | movie      |
+--------------+------------+