支持对已有数据表的结构重定义,包括增加、删除列。注意删除列要加restrict关键字。
* alter table nation add n_col varchar(10)\g
Executing . . .
(0 rows)
continue
* help nation\g
Executing . . .
Name: nation
Owner: ingres
Created: 03-apr-2011 04:18:27
Type: user table
Version: II10.0
Column Information:
Key
Column Name Type Length Nulls Defaults Seq
n_nationkey integer 4 no no
n_name char 25 no no
n_regionkey integer 4 no no
n_comment varchar 152yes null
n_col varchar 10yes null
continue
* alter table nation drop n_col\g
Executing . . .
E_US0F0A line 1, Syntax error on 'EOF'.The correct syntax is:
ALTER TABLE tablename
ADD [CONSTRAINT constraint_name] constraint_clause
| DROP CONSTRAINT constraint_name RESTRICT | CASCADE
| ADD [COLUMN] columnname format [default_clause] [null_clause]
[column_constraint]
| DROP [COLUMN] column_name RESTRICT | CASCADE
| RENAME TO new_table_name
| RENAME [COLUMN] old_column_name TO new_column_name
| ALTER [COLUMN] columnname format [default_clause] [null_clause]
(Mon Apr4 23:48:46 2011)
continue
* alter table nation drop n_col restrict\g
Executing . . .
(0 rows)
continue
Executing . . .
(0 rows)
continue
* help nation\g
Executing . . .
Name: nation
Owner: ingres
Created: 03-apr-2011 04:18:27
Type: user table
Version: II10.0
Column Information:
Key
Column Name Type Length Nulls Defaults Seq
n_nationkey integer 4 no no
n_name char 25 no no
n_regionkey integer 4 no no
n_comment varchar 152yes null
n_col varchar 10yes null
continue
* alter table nation drop n_col\g
Executing . . .
E_US0F0A line 1, Syntax error on 'EOF'.The correct syntax is:
ALTER TABLE tablename
ADD [CONSTRAINT constraint_name] constraint_clause
| DROP CONSTRAINT constraint_name RESTRICT | CASCADE
| ADD [COLUMN] columnname format [default_clause] [null_clause]
[column_constraint]
| DROP [COLUMN] column_name RESTRICT | CASCADE
| RENAME TO new_table_name
| RENAME [COLUMN] old_column_name TO new_column_name
| ALTER [COLUMN] columnname format [default_clause] [null_clause]
(Mon Apr4 23:48:46 2011)
continue
* alter table nation drop n_col restrict\g
Executing . . .
(0 rows)
continue
不支持分区、分析函数和groupby的rollup、cube扩展。
不支持表的重命名。
[ingres@redflag11012602 ~]$ sql tpch
INGRES TERMINAL MONITOR Copyright 2010 Ingres Corporation
VectorWise Linux Version VW 1.5.0 (a64.lnx/141)NPTL login
Mon Apr4 22:13:58 2011
Enter \g to execute commands, "help help\g" for help, \q to quit
continue
* alter table li rename to lineitem\g
Executing . . .
E_US2506 RENAME TABLE: Cannot rename table 'li'. Rename not supported for
VectorWise tables.
(Mon Apr4 22:14:15 2011)
continue
* \q
VectorWise Version VW 1.5.0 (a64.lnx/141)NPTL logout
Mon Apr4 22:18:31 2011
INGRES TERMINAL MONITOR Copyright 2010 Ingres Corporation
VectorWise Linux Version VW 1.5.0 (a64.lnx/141)NPTL login
Mon Apr4 22:13:58 2011
Enter \g to execute commands, "help help\g" for help, \q to quit
continue
* alter table li rename to lineitem\g
Executing . . .
E_US2506 RENAME TABLE: Cannot rename table 'li'. Rename not supported for
VectorWise tables.
(Mon Apr4 22:14:15 2011)
continue
* \q
VectorWise Version VW 1.5.0 (a64.lnx/141)NPTL logout
Mon Apr4 22:18:31 2011