偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

DB2列的修改及限制

數(shù)據(jù)庫(kù)
下文為您介紹了一些DB2列的修改語(yǔ)句的寫(xiě)法,以及其中的一些限制,如果您是剛剛接觸DB2數(shù)據(jù)庫(kù)的新手,不妨一看,對(duì)您會(huì)有所幫助。

DB2列的修改方法未必人人都會(huì),下面對(duì)DB2列的修改及限制作出詳細(xì)的介紹,如果您對(duì)DB2列的修改方法感興趣的話,不妨一看。

1.修改長(zhǎng)度
alter table tab_name alter c1 set data type varchar(20)
2.設(shè)置為非空
alter table tab_name alter c1 set not null
create table tab_name (id interger not null)
3.設(shè)置默認(rèn)值
create table tab_name (id integer,name varchar(10) with default 'none')
4.為列創(chuàng)建序列
使用關(guān)鍵字 generated always as identity
create table tab_name (id integer generated always as identity (start with 1,increment by 1))
5.唯一性約束
使用關(guān)鍵字primary key
create table tab_name (id int not null primary key)
使用關(guān)鍵字unique
alter table tab_name add constraint unique (id)
create unique index idx_name on tab_name (id)
6.檢查性約束
使用關(guān)鍵字check
ALTER TABLE BOOKS ADD BOOKTYPE CHAR(1) CHECK (BOOKTYPE IN ('F','N') )
7.參照約束
使用關(guān)鍵字references
CREATE TABLE AUTHORS (AUTHORID INTEGER NOT NULL PRIMARY KEY,
                      LNAME VARCHAR(100),
                      FNAME VARCHAR(100))
CREATE TABLE BOOKS (BOOKID INTEGER NOT NULL PRIMARY KEY,
                    BOOKNAME VARCHAR(100),
                    ISBN CHAR(10),
                    AUTHORID INTEGER REFERENCES AUTHORS)
 

 

【編輯推薦】

DB2刪除重復(fù)記錄的五種情況

九個(gè)DB2常用命令

aix下DB2創(chuàng)建表空間的方法

DB2索引設(shè)計(jì)準(zhǔn)則

對(duì)DB2故障處理及最佳實(shí)踐的淺析

 

責(zé)任編輯:段燃 來(lái)源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-11-03 14:52:26

DB2列轉(zhuǎn)行

2010-11-01 11:45:06

DB2管理頁(yè)大小

2010-11-03 11:26:39

DB2表空間

2010-11-03 16:25:51

DB2列函數(shù)

2010-11-03 15:35:27

DB2修改表

2010-09-06 14:08:00

DB2管理頁(yè)大小

2010-09-01 13:43:06

DB2表空間

2010-07-27 10:57:27

2010-09-07 17:12:46

DB2故障處理

2010-11-03 15:49:32

DB2刪除表

2010-08-26 11:37:38

DB2命令

2010-09-06 15:13:05

DB2

2010-11-02 14:08:29

DB2創(chuàng)建用戶

2010-11-03 14:16:29

DB2增量備份

2010-11-04 14:19:46

DB2事件監(jiān)控

2010-09-30 15:52:55

DB2循環(huán)查詢

2010-11-04 15:39:40

DB2 SQL語(yǔ)句

2010-11-04 11:07:56

DB2管理命令

2010-11-03 16:01:31

DB2索引的語(yǔ)法

2011-05-13 09:49:55

DB2數(shù)據(jù)移動(dòng)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)