Skip to main content

Create Table From SQL

Creates a Magpie table that displays data from a SQL query. Equivalent to a view in a traditional database. To copy data from the result of a SQL query into a new table, use the save result command instead.

Syntax

create [temp | temporary] table { <table spec> | <table name> } [in schema <schema reference>] from sql(<sql>)

Parameters

table spec

JSONA specification for saving the table. Note that persistence mapping and fields are not used when creating a table from a SQL query.

table name

String — The name of the table to save the data as.

schema reference

String — The name of the schema to create the table in. Defaults to the current schema.

sql

String — SQL query to use as the definition of the table.