oracle刪除主鍵,刪除索引


主鍵

--查詢主鍵
SELECT * from user_cons_columns c where c.table_name = '表名';

--刪除主鍵
alter table 表名 drop constraint 主鍵名;

--新增主鍵
alter table 表名 add constraint 主鍵名 primary key(字段名);

索引

--刪除普通索引
drop index 索引名字;

--創建普通索引
create index 索引名 on 表名(索引對應的列名);

--創建組合索引
create index 索引名 on 表名(列名1,列名2);

--創建主鍵索引
alter table 表名 add constraint 表名 add constraint 索引名 primary key (主鍵);

--刪除主鍵索引
alter table 表名 drop constraint 索引名;

--查詢索引
select * from user_ind_columns where index_name='索引名';
select * from user_indexes where table_name='表名';

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM