Sep 9, 2019 in Spark Sql
Q:

SQL INSERT INTO SELECT Statement

1 Answer

0 votes
Sep 9, 2019

The SQL INSERT INTO SELECT Statement

The INSERT INTO SELECT statement copies data from one table and inserts it into another table.

  • INSERT INTO SELECT requires that data types in source and target tables match
  • The existing records in the target table are unaffected

INSERT INTO SELECT Syntax

Copy all columns from one table to another table:

INSERT INTO table2
SELECT * FROM table1
WHERE condition;

Copy only some columns from one table into another table:

INSERT INTO table2 (column1column2column3, ...)
SELECT column1column2column3, ...
FROM table1
WHERE condition;

Related questions

0 votes
Sep 9, 2019 in Spark Sql
0 votes
Sep 9, 2019 in Spark Sql
...