1. Индивидуальное задание



Download 318,49 Kb.
bet5/9
Sana28.02.2022
Hajmi318,49 Kb.
#473855
1   2   3   4   5   6   7   8   9
Bog'liq
baza

Результат выборки:
LASTNAME FIRSTNAME 3
Гладких Татьяна 2 Панченко Владимир 4Порошин Сергей 4 Солощук Михаил 6Фастовский Эдуард 4 5 record(s) selected.


7.3 Проверка ограничений целостности

Для проверки триггера выполним запросы, первый будет вставлять и изменять записи в таблице лекций на значение дня недели больше 7.


UPDATE Lecture SET DayOfWeekNumber=8
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0438N Application raised error with diagnostic text: "The DayOfWeekNumberis incorrect". SQLSTATE=75001
INSERT INTO LECTURE(GROUPNAME, LECTURERID, TIMEID, WEEKTYPEID, DISCIPLINENUMBER, DAYOFWEEKNUMBER, AUDITORIUM, BUILDINGNAME)
VALUES('КИТ-64', 27, 4, 1, '54354559', 9, '202', 'ГАК');
------------------------------ Command Entered ------------------------------
INSERT INTO LECTURE(GROUPNAME, LECTURERID, TIMEID, WEEKTYPEID, DISCIPLINENUMBER, DAYOFWEEKNUMBER, AUDITORIUM, BUILDINGNAME)
VALUES('КИТ-64', 27, 4, 1, '54354559', 9, '202', 'ГАК') ;
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:
SQL0438N Application raised error with diagnostic text: "The DayOfWeekNumber is incorrect". SQLSTATE=75001


Приложения


Приложение А. SQL-скрипты создания таблиц базы данных

CREATE TABLE DB2ADMIN.DISCIPLINE (


DISCIPLINENUMBER VARCHAR (20) NOT NULL,
NAME VARCHAR (250) NOT NULL ,
HOURS SMALLINT NOT NULL ,
PRIMARY KEY (DISCIPLINENUMBER)
CREATE TABLE DB2ADMIN.WEEKTYPE (
WEEKTYPEID SMALLINT GENERATED ALWAYS AS IDENTITY
(START WITH 1, INCREMENT BY 1, NO CACHE ) ,
NAME VARCHAR (100) NOT NULL ,
PRIMARY KEY (WEEKTYPEID)
CREATE TABLE DB2ADMIN.TIME (
TIMEID SMALLINT GENERATED ALWAYS AS IDENTITY
(START WITH 1, INCREMENT BY 1, NO CACHE ) ,
HOUR SMALLINT NOT NULL,
MINUTE SMALLINT NOT NULL,
PRIMARY KEY (TIMEID)
CREATE TABLE DB2ADMIN.CHAIRTYPE (
CHAIRTYPEID SMALLINT GENERATED ALWAYS AS IDENTITY
(START WITH 1, INCREMENT BY 1, NO CACHE ) ,
NAME VARCHAR (250) NOT NULL,
PRIMARY KEY (CHAIRTYPEID)
CREATE TABLE DB2ADMIN.UNIVERSITY (
UNIVERSITYID INTEGER GENERATED ALWAYS AS IDENTITY
(START WITH 1, INCREMENT BY 1, NO CACHE ) ,
NAME VARCHAR (100) NOT NULL,
ACCREDITATIONLEVEL SMALLINT NOT NULL,
CREATIONDATE DATE NOT NULL ,
ADDRESS VARCHAR (250),
PHONE VARCHAR (40),
PRIMARY KEY (UNIVERSITYID)
CREATE TABLE DB2ADMIN.DEPARTMENT (
DEPARTMENTID INTEGER GENERATED ALWAYS AS IDENTITY
(START WITH 1, INCREMENT BY 1, NO CACHE ) ,
UNIVERSITYID INTEGER NOT NULL ,
NAME VARCHAR (250) NOT NULL ,
CREATIONDATE DATE NOT NULL ,
PRIMARY KEY (DEPARTMENTID) ,
FOREIGN KEY (UNIVERSITYID) REFERENCES DB2ADMIN.UNIVERSITY (UNIVERSITYID)
CREATE TABLE DB2ADMIN.CHAIR (
CHAIRID INTEGER GENERATED ALWAYS AS IDENTITY
(START WITH 1, INCREMENT BY 1, NO CACHE ) ,
CHAIRTYPEID SMALLINT NOT NULL ,
DEPARTMENTID INTEGER ,
NAME VARCHAR (250) NOT NULL ,
CREATIONDATE DATE NOT NULL ,
PRIMARY KEY (CHAIRID) ,
FOREIGN KEY (CHAIRTYPEID) REFERENCES DB2ADMIN.CHAIRTYPE (CHAIRTYPEID) ,
FOREIGN KEY (DEPARTMENTID) REFERENCES DB2ADMIN.DEPARTMENT (DEPARTMENTID)
CREATE TABLE DB2ADMIN.LECTURER (
LECTURERID INTEGER GENERATED ALWAYS AS IDENTITY
(START WITH 1, INCREMENT BY 1, NO CACHE ) ,
CHAIRID INTEGER NOT NULL ,
LASTNAME VARCHAR (70) NOT NULL ,
FIRSTNAME VARCHAR (70) NOT NULL ,
MIDDLENAME VARCHAR (70) NOT NULL ,
ACADEMICDEGREENAME VARCHAR (120) NOT NULL ,
POST VARCHAR (250) NOT NULL ,
PRIMARY KEY (LECTURERID) ,
FOREIGN KEY (CHAIRID) REFERENCES DB2ADMIN.CHAIR (CHAIRID)
CREATE TABLE DB2ADMIN.LECTURE (
GROUPNAME VARCHAR (20) NOT NULL ,
LECTURERID INTEGER NOT NULL ,
DISCIPLINENUMBER VARCHAR (20) NOT NULL ,
TIMEID SMALLINT NOT NULL ,
WEEKTYPEID SMALLINT NOT NULL ,
DAYOFWEEKNUMBER SMALLINT NOT NULL ,
AUDITORIUM VARCHAR (20) NOT NULL ,
BUILDINGNAME VARCHAR (20) NOT NULL ,
PRIMARY KEY (GROUPNAME, LECTURERID, TIMEID, WEEKTYPEID, DAYOFWEEKNUMBER) ,
FOREIGN KEY (LECTURERID) REFERENCES DB2ADMIN.LECTURER (LECTURERID) ,
FOREIGN KEY (DISCIPLINENUMBER) REFERENCES DB2ADMIN.DISCIPLINE (DISCIPLINENUMBER) ,
FOREIGN KEY (TIMEID) REFERENCES DB2ADMIN.TIME (TIMEID) ,
FOREIGN KEY (WEEKTYPEID) REFERENCES DB2ADMIN.WEEKTYPE (WEEKTYPEID)
инфологический процедурный база целостность

Download 318,49 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish