Contents Aster SQL and Function Reference


Add to my manuals
228 Pages

advertisement

Contents Aster SQL and Function Reference | Manualzz

CREATE TABLE AS Aster Data proprietary and confidential

In general, a unique constraint is violated when there are two or more rows in the table where the values of all of the columns included in the constraint are equal. However, two null values are not considered equal in this comparison. That means even in the presence of a unique constraint it is possible to store duplicate rows that contain a null value in at least one of the constrained columns. This behavior conforms to the SQL standard.

CREATE TABLE AS

CREATE TABLE AS - define a new table from the results of a query

Synopsis

CREATE [ FACT | DIMENSION ] TABLE table_name ( [

{ column_name data_type

| table_constraint }

[, ...]

] )

[ DISTRIBUTE BY { HASH ( column_name ) | REPLICATION } ] [ STORAGE { ROW

| COLUMN } ] [ COMPRESS [ HIGH | MEDIUM | LOW ] ] AS query

Description

CREATE TABLE AS creates a table and fills it with data computed by a SELECT command.

The table columns have the names and datatypes associated with the output columns of the

SELECT (except that you can override the column names by giving an explicit list of new column names). When you create a table in Aster Database, you should declare it to be a fact

table or a dimension table. See “Fact Tables and Dimension Tables” on page I-4 .

If the target table schema isn’t explicitly specified, it will be inferred from the output columns of the SELECT clause. Even if you do not specify names for the new tables columns, you can still specify a column as the distribution key.

CREATE TABLE AS creates a new table and evaluates the query just once to fill the new table.

The new table does not track subsequent changes to the source tables of the query.

Note that CREATE TABLE AS is not supported with logically partitioned tables (tables created with PARTITION BY HASH or PARTITION BY RANGE

)

. To work around this, see Creating a logically partitioned table from data in another table (page I-23) .

Warning!

When you

CREATE TABLE ... AS SELECT

, Aster Database runs

ANALYZE

on the new table after inserting the data. A read lock is placed on the new table while

ANALYZE

runs.

V--42 Database SQL and Function Reference, version 4.6.2

aster data

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Download PDF

advertisement

Table of contents