Search code examples
sqlhive

Duplicate a table by changing the name of the duplicated table


I want to duplicate a table by changing the name of the duplicated table by adding today's date.

The date should be generated automatically (the day of the execution of the request)

Example :

Original Table Name = x

Duplicate Table Name = x_20221216 <-- today's date


Solution

  • create table x_20221216 as select * from x