2023-10-17 23:36:14 +08:00
|
|
|
[discrete]
|
2023-06-06 00:38:55 +08:00
|
|
|
[[esql-rename]]
|
|
|
|
=== `RENAME`
|
|
|
|
|
2024-07-11 20:31:35 +08:00
|
|
|
The `RENAME` processing command renames one or more columns.
|
|
|
|
|
2023-11-06 15:42:13 +08:00
|
|
|
**Syntax**
|
2023-06-26 22:31:53 +08:00
|
|
|
|
|
|
|
[source,esql]
|
|
|
|
----
|
2023-11-06 15:42:13 +08:00
|
|
|
RENAME old_name1 AS new_name1[, ..., old_nameN AS new_nameN]
|
2023-06-26 22:31:53 +08:00
|
|
|
----
|
|
|
|
|
2023-11-06 15:42:13 +08:00
|
|
|
*Parameters*
|
|
|
|
|
|
|
|
`old_nameX`::
|
|
|
|
The name of a column you want to rename.
|
|
|
|
|
|
|
|
`new_nameX`::
|
2024-07-17 17:39:02 +08:00
|
|
|
The new name of the column. If it conflicts with an existing column name,
|
|
|
|
the existing column is dropped. If multiple columns are renamed to the same
|
|
|
|
name, all but the rightmost column with the same new name are dropped.
|
2023-11-06 15:42:13 +08:00
|
|
|
|
|
|
|
*Description*
|
|
|
|
|
|
|
|
The `RENAME` processing command renames one or more columns. If a column with
|
|
|
|
the new name already exists, it will be replaced by the new column.
|
|
|
|
|
|
|
|
*Examples*
|
2023-06-06 00:38:55 +08:00
|
|
|
|
|
|
|
[source,esql]
|
|
|
|
----
|
|
|
|
include::{esql-specs}/docs.csv-spec[tag=rename]
|
|
|
|
----
|
|
|
|
|
2023-06-26 22:31:53 +08:00
|
|
|
|
2023-06-06 00:38:55 +08:00
|
|
|
Multiple columns can be renamed with a single `RENAME` command:
|
|
|
|
|
|
|
|
[source,esql]
|
|
|
|
----
|
|
|
|
include::{esql-specs}/docs.csv-spec[tag=renameMultipleColumns]
|
|
|
|
----
|