Enforcement of Primary Key Constraints
An anonymous PRIMARY KEY
constraint on the column ID:
SQL> CREATE TABLE myTable
2 (ID NUMBER PRIMARY KEY,
3 NAME VARCHAR2(20)
4 );
Table created.
SQL>
Give constraint a name:
SQL> CREATE TABLE myTable
2 (ID NUMBER CONSTRAINT ID_PK PRIMARY KEY,
3 PORT_NAME VARCHAR2(20)
4 );
Table created.
SQL>
Home »
Oracle »
Table »
Oracle »
Table »
Primary Key:
- Enforcement of Primary Key Constraints
- Composite Primary Keys
- ORA-00001: insert a row with a duplicate value for a primary key
Related: