Advertisement
Maks140888

Untitled

Jun 9th, 2022
1,160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 7.70 KB | None | 0 0
  1. create table lessons (
  2.     id number not null,
  3.     name varchar(100),
  4.     time_start varchar(100),
  5.     time_end varchar(200),
  6.     constraint lesson_pk primary key (id)
  7. );
  8. create table days_week (
  9.     id number not null,
  10.     name varchar (50),
  11.     constraint day_pk primary key (id)
  12. );
  13.  
  14. create table facultys (
  15.     id number not null,
  16.     name varchar(100),
  17.     CONSTRAINT pk_faculty PRIMARY key (id)
  18. );
  19.  
  20. create table groups (
  21.     id number not null,
  22.     name varchar (50),
  23.     faculty_id number,
  24.     constraint group_pk primary key (id),
  25.     CONSTRAINT fk_faculty
  26.     FOREIGN KEY (faculty_id) REFERENCES facultys(id)
  27. );
  28. create table cind_lessons (
  29.     id number not null,
  30.     name varchar (100),
  31.     constraint cind_pk primary key (id)
  32. );
  33. create table subjects (
  34.     id number not null,
  35.     name varchar (100),
  36.     constraint subject_pk primary key (id)
  37. );
  38. create table corps (
  39.     id  number not null,  
  40.     name varchar(100),
  41.     CONSTRAINT pk_corps PRIMARY KEY (id)
  42. );
  43. create table students (
  44.     id number not null,
  45.     name varchar(100),
  46.     group_id numeric,
  47.     CONSTRAINT pk_student PRIMARY KEY (id),
  48.     CONSTRAINT fk_student_group
  49.     FOREIGN KEY (group_id) REFERENCES groups(id)
  50. );
  51. create table audiences (
  52.     id number not null,
  53.     name varchar (100),
  54.     corp_id number not null,
  55.     constraint audience_pk primary key (id),
  56.     CONSTRAINT fk_corps
  57.     FOREIGN KEY (corp_id) REFERENCES corps(id)
  58. );
  59. create table sheldule (
  60.     id number not null,
  61.     day_id number not null,
  62.     lesson_id number not null,
  63.     group_id number not null,
  64.     subject_id number not null,
  65.     cind_lesson_id number not null,
  66.     audience_id number not null,
  67.     day_date date,
  68.     CONSTRAINT sheldule_pk PRIMARY KEY (id),
  69.     CONSTRAINT fk_day_week
  70.         FOREIGN key (day_id)
  71.         references days_week (id),
  72.     CONSTRAINT fk_lesson_id
  73.         FOREIGN key (lesson_id)
  74.         references lessons (id),
  75.     CONSTRAINT fk_group_id
  76.         FOREIGN key (group_id)
  77.         references groups (id),
  78.     CONSTRAINT fk_subject_id
  79.         FOREIGN key (subject_id)
  80.         references subjects (id),
  81.     CONSTRAINT fk_cind_id
  82.         FOREIGN key (cind_lesson_id)
  83.         references cind_lessons (id),
  84.     CONSTRAINT fk_audience_id
  85.         FOREIGN key (audience_id)
  86.         references audiences (id)
  87. );
  88.  
  89. insert into lessons (id, name, time_start, time_end) values (1, 'Перша пара', '08:30', '09:50');
  90. insert into lessons (id, name, time_start, time_end) values (2, 'Друга пара', '10:05', '11:25');
  91. insert into lessons (id, name, time_start, time_end) values (3, 'Третя пара', '11:40', '13:00');
  92. insert into lessons (id, name, time_start, time_end) values (4, 'Четверта пара', '14:00', '15:20');
  93. insert into lessons (id, name, time_start, time_end) values (5, 'П^ята пара', '15:35', '16:55');
  94. insert into lessons (id, name, time_start, time_end) values (6, 'Шоста пара', '17:10', '18:30');
  95.  
  96. insert into days_week (id, name) values (1, 'Понеділок');
  97. insert into days_week (id, name) values (2, 'Вівторок');
  98. insert into days_week (id, name) values (3, 'Середа');
  99. insert into days_week (id, name) values (4, 'Четвер');
  100. insert into days_week (id, name) values (5, 'П^ятниця');
  101. insert into days_week (id, name) values (6, 'Субота');
  102. insert into days_week (id, name) values (7, 'Неділля');
  103.  
  104. insert into facultys (id, name) VALUES(1, 'Факультет Електроніки та Інформаційних технологій');
  105. insert into facultys (id, name) VALUES(2, 'Факультет Технічних систем та Енергоефективних технологій');
  106. insert into facultys (id, name) VALUES(3, 'Факультет Іноземнох фалосовії та Соціальних комунікацій');
  107. insert into facultys (id, name) VALUES(4, 'Навчально-науковий інститут права');
  108. insert into facultys (id, name) VALUES(5, 'Навчально-науковий інститут бізнесу та економіки');
  109. insert into facultys (id, name) VALUES(6, 'Навчально-науковий медичний інститут');
  110.  
  111. insert into  groups (id, name, faculty_id) values (1, 'ІН-94-1', 1);
  112. insert into groups (id, name, faculty_id) values (2, 'ІН-91', 1);
  113.  
  114. insert into  cind_lessons (id, name) values (1, 'онлайн');
  115. insert into  cind_lessons (id, name) values (2, 'лабораторна робота');
  116. insert into  cind_lessons (id, name) values (3, 'лекція');
  117. insert into  cind_lessons (id, name) values (4, 'атестація');
  118.  
  119. insert into subjects (id, name) values (1, 'Бази даних та інформац. сист.');
  120. insert into subjects (id, name) values (2, 'Первинні мер. та мер.оператор');
  121. insert into subjects (id, name) values (3, 'Військова підготовка');
  122. insert into subjects (id, name) values (4, 'Обр. зобр та мультимедія');
  123. insert into subjects (id, name) values (5, 'Серверні технологій та веб-програм.');
  124. insert into subjects (id, name) values (6, 'Клієнтські технології та веб-програм.');
  125. insert into subjects (id, name) values (7, 'Дисц. за вибр. студента');
  126.  
  127. insert into corps (id, name) values (1, 'Головний');
  128. insert into corps (id, name) values (2, 'Новий');
  129. insert into corps (id, name) values (3, 'Центральний');
  130.  
  131. insert into audiences (id, name, corp_id) values (1, '210', 1);
  132. insert into audiences (id, name, corp_id) values (2, '310', 2);
  133. insert into audiences (id, name, corp_id) values (3, '410', 3);
  134.  
  135. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  136. VALUES(1, 1, 1, 2, 2, 3, 1, to_date('2022-06-06','YYYY-MM-DD'));
  137.  
  138. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  139. VALUES(2, 1, 2, 2, 2, 4, 2, to_date('2022-06-06','YYYY-MM-DD'));
  140.  
  141. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  142. VALUES(3, 2, 1, 1, 2, 1, 2, to_date('2022-06-07','YYYY-MM-DD'));
  143.  
  144. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  145. VALUES(4, 2, 2, 2, 2, 2, 1,to_date('2022-06-07','YYYY-MM-DD'));
  146.  
  147. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  148. VALUES(5, 3, 3, 1, 2, 1, 3,to_date('2022-06-08','YYYY-MM-DD'));
  149.  
  150. insert into sheldule(id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  151. VALUES(6, 3, 3, 1, 2, 2, 3,to_date('2022-06-08','YYYY-MM-DD'));
  152.  
  153. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  154. VALUES(7, 3, 3, 1, 2, 3, 3,to_date('2022-06-08','YYYY-MM-DD'));
  155.  
  156. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  157. VALUES(8, 3, 3, 1, 2, 4, 3,to_date('2022-06-08','YYYY-MM-DD'));
  158.  
  159. insert into sheldule(id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  160. VALUES(9, 4, 2, 2, 2, 2, 4,to_date('2022-06-09','YYYY-MM-DD'));
  161.  
  162. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  163. VALUES(10, 4, 3, 2, 2, 3, 5,to_date('2022-06-09','YYYY-MM-DD'));
  164.  
  165. insert into sheldule(id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  166. VALUES(11, 5, 1, 1, 2, 1, 7,to_date('2022-06-10','YYYY-MM-DD'));
  167.  
  168. insert into sheldule (id, day_id, audience_id,cind_lesson_id, group_id, lesson_id, subject_id, day_date)
  169. VALUES(13, 5, 1, 1, 2, 2, 7,to_date('2022-06-10','YYYY-MM-DD'));
  170.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement