带您了解DB2表管理语句


  本文标签:DB2表管理

  数据库的表管理是数据库系统中非常重要的部分,下面就带您了解一些DB2表管理的语句写法,供您参考学习,希望对您学习DB2表管理有所帮助  。

  创建表

  CREATE TABLE BOOKS
( BOOKID INTEGER,
BOOKNAME VARCHAR(100),
ISBN CHAR(10) )

  使用like创建表
CREATE TABLE MYBOOKS LIKE BOOKS

  制定表空间
db2 create table T1 (c1 int ...) in TS1
db2 create table T2 (c1 float ...) in TS1

  删除表
drop table tab_name

  添加删除列
db2 => create table test (c1 int)
DB20000I The SQL command completed successfully.
db2 => alter table test add c2 char(8)
DB20000I The SQL command completed successfully.
db2 => alter table test drop c2  
DB20000I The SQL command completed successfully.

  以上就是DB2表管理语句的介绍  。