This topic describes how to use the INSERT INTO statement in Spark Streaming SQL.

Syntax

INSERT INTO tbName[(columnName[,columnName]*)]
queryStatement;

Example

INSERT INTO LargeOrders
SELECT * FROM Orders WHERE units > 1000;

Note

  • Spark Streaming SQL does not allow you to use a separate SELECT statement for query. A SELECT statement must be used together with a CTAS statement or be contained in an INSERT INTO statement.
  • For a single job, an SQL file can contain multiple Data Manipulation Language (DML) operations, and multiple data sources and sinks.