赞
踩
oracle数据库版本:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0
greenplum数据库版本:Greenplum Database 5.11.1
1、创建临时表:
SQL> create table t_tmp(id number,name varchar2(10));
Table created
2、向临时表中插入数据:
SQL> insert into t_tmp values(1,'小一');
1 row inserted
SQL> insert into t_tmp values(2,'小二');
1 row inserted
SQL> insert into t_tmp values(3,'小三');
1 row inserted
SQL> insert into t_tmp values(4,'小四');
1 row inserted
SQL> commit;
Commit compete
3、查看表中数据:
4、创建视图:
SQL> create view v_tmp as select * from t_tmp;
View created
5、查看视图内数据:
6、给表重命名:
SQL> alter table t_tmp rename to t_tmp_n;
Table altered
7、继续查看视图数据:
操作截图:
1、创建临时表:
hold_test=# create table t_tmp(id int,name varchar(10));
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
2、插入临时数据:
hold_test=# insert into t_tmp values(1,'小一'),(2,'小二'),(3,'小三'),(4,'小四');
INSERT 0 4
3、查看表中数据:
hold_test=# select * from t_tmp;
id | name
----+------
3 | 小三
4 | 小四
1 | 小一
2 | 小二
(4 rows)
SELECT
4、创建视图:
hold_test=# create view v_tmp as select * from t_tmp;
CREATE VIEW
5、查看视图中数据:
hold_test=# select * from v_tmp;
id | name
----+------
3 | 小三
4 | 小四
1 | 小一
2 | 小二
(4 rows)
SELECT
6、给表重命名:
hold_test=# alter table t_tmp rename to t_tmp_n;
ALTER TABLE
7、继续查看视图中数据:
hold_test=# select * from v_tmp;
id | name
----+------
3 | 小三
4 | 小四
1 | 小一
2 | 小二
(4 rows)
SELECT
操作截图:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。