Neoview SQL Reference Manual (R2.3)
SELECT * FROM T WHERE b = ‘A’;
• A row is not returned in this example. A case sensitive comparison is done since column ‘b’
is case sensitive.
SELECT * FROM T WHERE b = ‘A’ (not casespecific);
Examples of CREATE SET TABLE
This is an example of creating a SET table:
>>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.
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;
An error is returned since the data attribute of column “a”, a char, does not match the data
attribute of the select list item “b” a numeric.
80 SQL Statements