Constraints

From rbachwiki
Revision as of 16:07, 13 October 2017 by Bacchas (talk | contribs) (Created page with "= Constraints PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, NOT NULL = == Adding Constraints at table creation == CREATE TABLE a_animals( animal_id NUMBER(6), name VARCHAR2(25),...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Constraints PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, NOT NULL

Adding Constraints at table creation

CREATE TABLE a_animals(
animal_id NUMBER(6),
name VARCHAR2(25),
license_tag_number NUMBER(10),
admit_date DATE CONSTRAINT ail_admit_date_nn NOT NULL,
adoption_id NUMBER(5),
vaccination_date DATE CONSTRAINT ail_vaccination_date_nn NOT NULL,

CONSTRAINT ail_animal_id_pk PRIMARY KEY(animal_id),
CONSTRAINT ail_license_pk UNIQUE(license_tag_number)

);

Check Constraint on a specific Table