返回首页

gbase数据、南大通用产品文档:GBase8aUPDATE

更新日期:2024年09月11日

功能说明
UPDATE 时,不能更新自增列。
示例
create table t2(a int auto_increment primary key,b varchar(100), c int)
distributed by ('b');

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1034
insert into t2(b,c) values('a1',1),('a2',2),('a3',3),('a4',4),('a5',5);
gbase> SELECT * FROM t2;
+---+------+------+
| a | b
| c
|
+---+------+------+
| 3 | a2
|
2 |
| 1 | a3
|
3 |
| 2 | a1
|
1 |
| 6 | a5
|
5 |
| 4 | a4
|
4 |
+---+------+------+
5 rows in set (Elapsed: 00:00:00.02)
gbase> update t2 set c = 144 where b = 'a2';
Query OK, 1 row affected (Elapsed: 00:00:00.08)
Rows matched: 1
Changed: 1
Warnings: 0
gbase> update t2 set a = 441 where b = 'a2';
ERROR 1235 (42000): This version of GBase doesn't yet support 'update/merge on
auto_increment column'
gbase> SELECT * from t2;
+---+------+------+
| a | b
| c
|
+---+------+------+
| 1 | a3
|
3 |
| 3 | a2
|
144 |

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1035
| 2 | a1
|
1 |
| 6 | a5
|
5 |
| 4 | a4
|
4 |
+---+------+------+
5 rows in set (Elapsed: 00:00:00.02)

| 15 | NULL
| D
|
149 | 92.6666666666667 |
| 10 | 2016-06-01 | NULL
|
125 |
0 |
| 11 | 2016-07-02 | NULL
|
131 |
9 |
| 12 | 2016-08-03 | NULL
|
152 |
134 |
+----+------------+-------+-------------+------------------+

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
871

建表语句:
create table t(a int,b varchar(10),c varchar(10));
数据文件:
1|first
2|second
加载过程:

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 226
gbase> load data infile 'ftp://192.168.88.141/load_data/autofill.tbl' into table t
est.t fields terminated by '|' autofill;
Query OK, 2 rows affected, 3 warnings
Task 1107 finished, Loaded 2 records, Skipped 0 records
查询入库数据:
gbase> select * from t;
+------+--------+------+
| a | b | c |
+------+--------+------+
| 2 | second | NULL |
| 1 | first | NULL |
+------+--------+------+
2 rows in set