Composite Primary Keys

A multicolumn PRIMARY KEY is based on two or more columns. The combination of column values will collectively have to be unique. All columns individually and collectively will have to contain values.


SQL> CREATE TABLE myTable
  2  ( Category  NUMBER,
  3    Year      NUMBER,
  4    No        NUMBER,
  5    Title     VARCHAR2(30),
  6    CONSTRAINT   MY_PK PRIMARY KEY (Category, Year,No)
  7  );

Table created.

SQL>
Home »
Oracle »
Table » 

Primary Key:
  1. Enforcement of Primary Key Constraints
  2. Composite Primary Keys
  3. ORA-00001: insert a row with a duplicate value for a primary key
Related: