Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ALTER当已经为现有表定义了主键时,我需要知道如何使用 table 命令定义复合主键?
ALTER
数据库: Oracle 11g
删除现有PRIMARY KEY约束,然后重新创建它。假设调用了现有的table_pk,并且新的复合主键将打开column1并且column2:
PRIMARY KEY
table_pk
column1
column2
ALTER TABLE table DROP CONSTRAINT table_pk; ALTER TABLE table ADD CONSTRAINT table_pk PRIMARY KEY (column1, column2);