DB2 DDL Primary keyDROP Statement DDL FOREIGN KEY
- Uniquely identified column which is used to identify the row uniquely is known as primary key.
- Primary key can be defined during the CREATE TABLE or ALTER TABLE.
- Primary keys definition is optional in CREATE TABLE or ALTER TABLE.
- Primary key is unique key and cannot contain NULL values.
- Primary key can be only one column or more than one column.
- The index on Primary key is called as Primary index.
- If primary key is created on the specific table, the primary index will be automatically created by DB2.
Rule for primary key:
- No duplicates are allowed under primary key.
- Only one designated primary key can be available in a table.
- Null values or junk values are not allowed under primary key.
PRIMARY KEY(Column1, column2…)
DROP Statement DDL FOREIGN KEY