欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

oracle中添加刪除主鍵的方法

 更新時(shí)間:2017年01月05日 16:46:38   作者:忙碌的菠蘿  
這篇文章主要介紹了oracle中添加刪除主鍵的方法,需要的朋友可以參考下

1、創(chuàng)建表的同時(shí)創(chuàng)建主鍵約束

(1)無(wú)命名

create table student (
 studentid int primary key not null,
 studentname varchar(8),
 age int);

(2)有命名

create table students (
  studentid int ,
  studentname varchar(8),
  age int,
  constraint yy primary key(studentid));

2、刪除表中已有的主鍵約束

(1)有命名

 alter table students drop constraint yy;

(2)無(wú)命名

可用

SELECT  *  from  user_cons_columns;

查找表中主鍵名稱(chēng)得student表中的主鍵名為SYS_C002715

alter table student drop constraint SYS_C002715;

3、向表中添加主鍵約束

alter table student add constraint pk_student primary key(studentid);

以上所述是小編給大家介紹的oracle中添加刪除主鍵的方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論