YIELD clause¶
The YIELD clause selects columns to be used by subsequent statements, or renames those columns.
Syntax¶
- yield_clause
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:
- Calls the procedure
show_graphs()to obtain information about graphs. For more information, see CALL procedures. - Selects the columns
graph_typeandnameusing the YIELD clause, and renames the columnnametograph_name. - Returns the columns
graph_typeandgraph_name.
Return:
+--------------+------------+
| graph_type | graph_name |
+--------------+------------+
| movie_type | movie |
+--------------+------------+