This topic describes the syntax of the CREATE TABLE statement in Spark SQL.

Syntax

CREATE TABLE tbName[(columnName dataType [,columnName dataType]*)]
USING providerName
OPTIONS(propertyName=propertyValue[,propertyName=propertyValue]*);
The following code shows the syntax of CREATE TABLE AS SELECT (CTAS). The syntax combines the statement to create a table and the statement to write query results to the table:
CREATE TABLE tbName[(columnName dataType [,columnName dataType]*)]
USING providerName
OPTIONS(propertyName=propertyValue[,propertyName=propertyValue]*)
AS
queryStatement;

Description

In the syntax, the field information of the table is optional.
CREATE TABLE kafka_table 
USING kafka 
OPTIONS (
kafka.bootstrap.servers = "${BOOTSTRAP_SERVERS}",
subscribe = "${TOPIC_NAME}");