Professional Documents
Culture Documents
Constrangeri
Constrangeri
Fiecare constrangere are un nume (nume-tabel_nume-coloana_tipul-constrangerii). CREATE TABLE clienti ( client_id NUMBER(4) CONSTRAINT client_client_id_pk PRIMARY KEY, nume VARCHAR(13) NOT NULL, email VARCHAR(14), telefon VARCHAR(10), departament_id NUMBER(5), oras VARCHAR(20) CONSTRAINT client_oras_in_lista CHECK(oras IN(Iasi, Vaslui)) CONSTRAINT client_email_telefon_uk UNIQUE(email, telefon), CONSTRAINT client_departament_id_fk FOREIGN KEY(departament_id) REFERENCES departamente(department_id) ); UNIQUE trebuie definit la nivel de table PRIMARY KEY, FOREIGN KEY pot fi definite si la nivel de table si la nivel de camp FOREIGN KEY poate fi definit si la nivel de table si la nivel de camp CHECK --- || ---