主鍵
--查詢主鍵
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='表名';