- What is CTAS table?
- What is a CTAS query?
- How do you overwrite a table in Athena?
- How do I drop multiple tables in Athena?
What is CTAS table?
The CREATE TABLE AS SELECT (CTAS) statement is one of the most important T-SQL features available. CTAS is a parallel operation that creates a new table based on the output of a SELECT statement. CTAS is the simplest and fastest way to create and insert data into a table with a single command.
What is a CTAS query?
A CREATE TABLE AS SELECT (CTAS) query creates a new table in Athena from the results of a SELECT statement from another query. Athena stores data files created by the CTAS statement in a specified location in Amazon S3. For syntax, see CREATE TABLE AS.
How do you overwrite a table in Athena?
If this is not the case and you still want to overwrite your table then you can simply run DROP TABLE before you run CREATE TABLE statement.
How do I drop multiple tables in Athena?
Your answer
An alternative is to create the tables in a specific database. Dropping the database will then delete all the tables. CREATE DATABASE db1; CREATE EXTERNAL TABLE table1 ...; CREATE EXTERNAL TABLE table2 ...; DROP DATABASE db1 CASCADE; The DROP DATABASE command will delete the table1 and table2 tables.