2023-06-06 00:38:55 +08:00
|
|
|
[[esql-rename]]
|
|
|
|
=== `RENAME`
|
|
|
|
|
2023-06-26 22:31:53 +08:00
|
|
|
Use `RENAME` to rename a column using the following syntax:
|
|
|
|
|
|
|
|
[source,esql]
|
|
|
|
----
|
2023-06-26 22:33:41 +08:00
|
|
|
RENAME <new-name> = <old-name>
|
2023-06-26 22:31:53 +08:00
|
|
|
----
|
|
|
|
|
|
|
|
For example:
|
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
|
|
|
If a column with the new name already exists, it will be replaced by the new
|
|
|
|
column.
|
|
|
|
|
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]
|
|
|
|
----
|