Column and Table Constraints
Constraints can be column constraints or table constraints.
A column constraint is specified as part of a column definition and applies only to that column.
A table constraint is declared independently from a column definition and can apply to more than one column in a table. Table constraints must be used when more than one column must be included in a constraint.
For example, if a table has two or more columns in the primary key, you must use a table constraint to include both columns in the primary key. Consider a table that records events occurring in a system.
A number of different event can occur in different time or same time but assuming no same event occur in same time and same type.
This can be enforced in the table by including both the event_type and event_time columns in a two-column primary key, as shown in the following example.
CREATE TABLE System_process
CONSTRAINT event_key PRIMARY KEY (event_typeID , event_time) )