Neoview SQL Reference Manual (R2.4)
>>Create SET table T (a int not null, b int, primary key (a));
--- SQL operation complete.
>>insert into T values(1,2);
--- 1 row(s) inserted.
>>insert into T values(1,2);
--- 0 row(s) inserted.
>>insert into T values(1, 4);
*** ERROR[8102] The operation is prevented by a unique constraint.
--- 0 row(s) inserted.
>>select * from T;
A B
----------- -----------
1 2
--- 1 row(s) selected.
Example of CREATE SET VOLATILE TABLE
This example shows creating a volatile table as a SET table:
>>CREATE SET VOLATILE TABLE t (a int not null, b int, primary key (a));
--- SQL operation complete.
>>INSERT INTO t VALUES (1,2);
--- 1 row(s) inserted.
>>INSERT INTO t VALUES (1,2);
--- 0 row(s) inserted.
Examples of CREATE TABLE AS
This section shows the column attribute rules used to generate and specify the column names
and data types of the table being created.
• If column-attributes are not specified, the select list items of the select-query are used
to generate the column names and data attributes of the created table. If the select list item
is a column, then it is used as the name of the created column. For example:
create table t as select a,b from t1
Table t has 2 columns named (a,b) and the same data attributes as columns from table t1.
• If the select list item is an expression, it must be renamed with an AS clause. An error is
returned if expressions are not named. For example:
create table t as select a+1 c from t1
Table t has 1 column named (c) and data attribute of (a+1)
create table t as select a+1 from t1
An error is returned, expression must be renamed.
• If column-attributes are specified and contains datatype-info, then they override
the attributes of the select items in the select query. These data attributes must be compatible
with the corresponding data attributes of the select list items in the select-query.
create table t(a int) as select b from t1
Table t has one column named “a” with datatype “int”.
create table t(a char(10)) as select a+1 b from t1;
CREATE TABLE Statement 91