Key fields

From Oracle FAQ
Jump to: navigation, search

Key fields are the subset of fields within a table for which data MUST be entered and validated before a new record can be added to the table. Failure to correctly enter data in all the key fields will prevent a new record from being added to the table.

This can be implemented in Oracle by defining all key fields (columns) as either part of the PRIMARY KEY or NOT NULL.

Example[edit]

In the below example, c1 and c2 are key fields, but c3 is not:

CREATE TABLE t1(
  c1 NUMBER       PRIMARY KEY,
  c2 VARCHAR2(30) NOT NULL,
  c3 VARCHAR2(10)
);
Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #