当前位置: 移动技术网 > IT编程>数据库>DB2 > HGDBPG表中添加删除列的方法

HGDBPG表中添加删除列的方法

2018年02月21日  | 移动技术网IT编程  | 我要评论

HGDB表中添加删除列:

highgo=# \d test

Table "public.test"

Column | Type | Modifiers

--------+---------+------------

id | integer | default 15

no | integer |

highgo=# select * from test;

id | no

----+----

15 | 1

15 | 2

15 |

(3 rows)

highgo=# alter table test add column name varchar(10);

ALTER TABLE

highgo=# select * from test;

id | no | name

----+----+------

15 | 1 |

15 | 2 |

15 | |

(3 rows)

highgo=# insert into test (no,name) values (1,'a');

INSERT 0 1

highgo=#

highgo=# select * from test;

id | no | name

----+----+------

15 | 1 |

15 | 2 |

15 | |

15 | 1 | a

(4 rows)

highgo=# alter table test drop column name;

ALTER TABLE

highgo=# select * from test;

id | no

----+----

15 | 1

15 | 2

15 |

15 | 1

(4 rows)

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网