Laboratory_5-6

This commit is contained in:
nikbel2004@outlook.com 2024-09-16 00:15:26 +04:00
parent 973ee54756
commit 910043144d

View File

@ -1,22 +1,23 @@
CREATE TABLE Genre ( CREATE TABLE Genre (
GenreID INTEGER PRIMARY KEY, GenreID INTEGER PRIMARY KEY,
GenreName varchar(30) NOT NULL GenreName varchar(30) NOT NULL
); );
CREATE TABLE Employee ( CREATE TABLE Employee (
EmployeeID int PRIMARY KEY, EmployeeID int PRIMARY KEY,
GenreID INTEGER, GenreID INTEGER,
FIO varchar(50) NOT NULL, FIO varchar(50) NOT NULL,
FOREIGN KEY (GenreID) REFERENCES Genre (GenreID) FOREIGN KEY (GenreID) REFERENCES Genre (GenreID)
); );
CREATE TABLE Book ( CREATE TABLE Book (
BookID INTEGER PRIMARY KEY, BookID INTEGER PRIMARY KEY,
GenreID INTEGER, GenreID INTEGER,
Title varchar(200) NOT NULL, Title varchar(200) NOT NULL,
Author varchar(200) NOT NULL, Author varchar(200) NOT NULL,
FOREIGN KEY (GenreID) REFERENCES Genre (GenreID)
FOREIGN KEY (GenreID) REFERENCES Genre (GenreID)
); );
INSERT INTO Genre VALUES INSERT INTO Genre VALUES
@ -41,7 +42,7 @@ COPY (SELECT table_to_xml('Book', true, false, '')) to 'E:\MiAKD\Lab 5-6\book.xm
/* Индексы (6 lab) */ /* === Индексы (6 lab) === */
CREATE INDEX index_g CREATE INDEX index_g
ON Genre (GenreID) ON Genre (GenreID)