sqlamazon-athena

How to rename a table in Athena?


probably a very trivial question but I'm not sure about this and also don't want to lose the table. How do I rename a table in Athena?

Database name - friends
table name - centralPark
desired table name -centralPerk

Solution

  • you can't!

    see the list of unsupported DDL in Athena.

    what you can do is to make a new table using select:

    CREATE TABLE centralPark
    AS SELECT * FROM centralPerk
    WITH DATA
    

    and drop the old table:

    DROP TABLE IF EXISTS centralPerk