Теория баз данных


HOME_PHON IS NOT NULL OR


(

NUM_READER intnot null.

NAME varchar(30) not null.

BIRTH_DAY datetime not null

constraint CKC_BIRTH_DAY_READERS check

(

(DateDiffCyear. GetDate().BIRTH_DAY) >=17 )

),

SEX chard) not null

constraint CKC_SEX_READERS check

(

SEX in СМ'.'1'.'м'.'ж')).

HOME_PHON char(9) null.

WORK_PHON char(9) null,

constraint PK_READERS primary key (NUM_READER).

constraint CKT_READERS check

(

( HOME_PHON IS NOT NULL OR WORK_PHON IS NOT NULL))

)

go

/* Table: CATALOG */



/* ================================ */



create table CATALOG

( KW KOD smallint not null.

NAME_KW varchar(255) null, constraint PK_CATALOG primary key (KW_KOD)

)

go

/* ================================ */

/* Table: EXEMPLAR */

create table EXEMPLAR

(

INVJUMER

int not

null.

ISBN

varchar(14)

not null .

NUM_READER

int

null.

PRESENT

bit not

null.

DATE_IN

datetime

null.

DATE OUT

datetime

null.

constraint PK_EXEMPLAR primary key (INVJUMER) )

go

/* ================================ */

/* Index: RELATION_43_FK ' . */ /*

/* ================================ */

create index RELATION_43_FK on EXEMPLAR (ISBN) .

go

/* Index: RELATION_44_FK */

/* ================================ */

create index RELATION_44_FK on EXEMPLAR (NUM_READER) go

/* ================================ */

/* Table: RELATION_67 */

/* ================================ */

create table RELATION_67

(

ISBN varchar(14) not null, KW_KOD smallint not null, constraint

PK_RELATION_67 primary key (ISBN, KW_KOD)

)

go

/* ================================ */

/* Index: IOIINEONY_E_IAEANOE_CIAIEE_FK */

/* ================================ */

create index IOIINEONY_E_IAEANOE_CIAIEE_FK on RELATION_67 (ISBN) go

/* ================================ */

/* Index: I_AANOAAEAIA_A_EIEAAO_FK */

create index I_AANOAAEAIA_A_EIEAAO_FK on RELATION_67 (KW_KOD)

go

alter table EXEMPLAR

add constraint FK_EXEMPLAR_RELATION_BOOKS foreign key (ISBN)

Содержание  Назад  Вперед