INSERT OVERWRITE statement overwrites a table data of an existing table or a data in a given directory. Tajo’s INSERT OVERWRITE statement follows INSERTINTOSELECT statement of SQL. The examples are as follows:

createtablet1(col1int8,col2int4,col3float8);-- when a target table schema and output schema are equivalent to each otherINSERTOVERWRITEINTOt1SELECTl_orderkey,l_partkey,l_quantityFROMlineitem;-- orINSERTOVERWRITEINTOt1SELECT*FROMlineitem;-- when the output schema are smaller than the target table schemaINSERTOVERWRITEINTOt1SELECTl_orderkeyFROMlineitem;-- when you want to specify certain target columnsINSERTOVERWRITEINTOt1(col1,col3)SELECTl_orderkey,l_quantityFROMlineitem;

In addition, INSERT OVERWRITE statement overwrites table data as well as a specific directory.