ВУЗ:
Составители:
Рубрика:
14
CONSTRAINT "ID_AUTHOR" PRIMARY KEY("CODE_AUTHOR") USING
INDEX TABLESPACE "DB_BOOKS") TABLESPACE "DB_BOOKS";
CREATE TABLE "ADMIN_BOOKS"."DELIVERIES" ("CODE_DELIVERY"
NUMBER(4) NOT NULL, "NAME_DELIVERY" CHAR(35), "NAME_COMPANY"
CHAR(30) NOT NULL, "ADDRESS" VARCHAR2(100), "PHONE" CHAR(11)
NOT NULL, "INN" CHAR(13), CONSTRAINT "ID_DELIVERY" PRIMARY
KEY("CODE_DELIVERY") USING INDEX TABLESPACE "DB_BOOKS")
TABLESPACE "DB_BOOKS";
CREATE TABLE "ADMIN_BOOKS"."PUBLISHING_HOUSE"
("CODE_PUBLISH" NUMBER(4) NOT NULL, "PUBLISH" CHAR(30) NOT
NULL, "CITY" CHAR(15), CONSTRAINT "ID_PUBLISH" PRIMARY
KEY("CODE_PUBLISH") USING INDEX TABLESPACE "DB_BOOKS")
TABLESPACE "DB_BOOKS";
CREATE TABLE "ADMIN_BOOKS"."BOOKS" ("CODE_BOOK"
NUMBER(5) NOT NULL, "TITLE_BOOK" VARCHAR2(100) NOT NULL,
"CODE_AUTHOR" NUMBER(3) NOT NULL, "PAGES" NUMBER(4),
"CODE_PUBLISH" NUMBER(4) NOT NULL, CONSTRAINT "ID_BOOK_FK"
PRIMARY KEY("CODE_BOOK") USING INDEX TABLESPACE "DB_BOOKS",
CONSTRAINT "ID_AUTHOR_FK" FOREIGN KEY("CODE_AUTHOR")
REFERENCES "ADMIN_BOOKS"."AUTHORS"("CODE_AUTHOR") ON
DELETE CASCADE, CONSTRAINT "ID_PUBLISH_FK" FOREIGN
KEY("CODE_PUBLISH") REFERENCES
"ADMIN_BOOKS"."PUBLISHING_HOUSE"("CODE_PUBLISH") ON DELETE
CASCADE) TABLESPACE "DB_BOOKS";
CREATE TABLE "ADMIN_BOOKS"."PURCHASES" ("CODE_BOOK"
NUMBER(5) NOT NULL, "DATE_ORDER" DATE NOT NULL,
"CODE_DELIVERY" NUMBER(4) NOT NULL, "TYPE_PURCHASE" CHAR(1)
NOT NULL, "COST" NUMBER(10,2) NOT NULL, "AMOUNT" NUMBER(4) NOT
NULL, "CODE_PURCHASE" NUMBER(5) NOT NULL, CONSTRAINT
"ID_PURCHASE" PRIMARY KEY("CODE_PURCHASE") USING INDEX
TABLESPACE "DB_BOOKS", CONSTRAINT "ID_BOOK_FK2" FOREIGN
KEY("CODE_BOOK") REFERENCES
"ADMIN_BOOKS"."BOOKS"("CODE_BOOK"), CONSTRAINT
"ID_DELIVERY_FK" FOREIGN KEY("CODE_DELIVERY") REFERENCES
"ADMIN_BOOKS"."DELIVERIES"("CODE_DELIVERY")) TABLESPACE
"DB_BOOKS";
Не забывайте: сначала создаются справочники, в которых есть только
ключевые поля типа PRIMARY, а затем другие таблицы, в которых соз-
даются внешние ключи типа FOREIGN KEY.
Страницы
- « первая
- ‹ предыдущая
- …
- 13
- 14
- 15
- 16
- 17
- …
- следующая ›
- последняя »