[NameOfColumn] DATE NOT NULL,UNIQUE: UNIQUE requires each new value entered into that column be different from all those value entered before.
PRIMARY KEY: The PRIMARY KEY is the one column that identifies the column from all the others. As such it is considered UNIQUE, meaning each value entered will be different from all the other values entered. However, you don't use the UNIQUE qualifier when declaring the PRIMARY KEY (it is implied). Here is an example:
[NameOfColumn] [DataType] PRIMARY KEY,The PRIMARY KEY can be a composite of multiple column entries, which means each each key must be comprised of a unique combination of values from the participating columns. The composite key is defined at the end of the table creation statement, after the last column definition:
constraint [Name_Of_Composite_Primary_Key] PRIMARY KEY ([Name_of_1st_Participating_column], [Name_of_2nd_Participating_column], [...] )FOREIGN KEY: a FOREIGN KEY uses as its domain of possible values a PRIMARY KEY from another table. This is written as a column definition:
constraint [Name_Of_Foreign_Key] foreign key ([Name_of_External_Column])Note, you can not refer to a table in another database, only to another table in the same database. But you can refer to the primary key even in the same table.
The references clause tells the database to delete the dependent row when the corresponding row in the parent table is deleted.
CHECK: The CHECK constraint allows you to specify only certain values can be inserted, as such:
[Name_Of_Column] [Datatype] Check([Name_Of_Column] [operator] [value]),For example,
Stats VARCHAR2(2) CHECK (Stats => 0)....means that any values entered for the Stats column must be 0 or higher. Material taken from this book....