INSERT INTO SUBJECTS(NAME)
SELECT 'Русский язык' FROM DUAL
UNION ALL
SELECT 'Математика' FROM DUAL
UNION ALL
SELECT 'Физика' FROM DUAL
UNION ALL
SELECT 'Информатика' FROM DUAL
UNION ALL
SELECT 'Английский язык' FROM DUAL
UNION ALL
SELECT 'История' FROM DUAL
UNION ALL
SELECT 'Обществознание' FROM DUAL
UNION ALL
SELECT 'Химия' FROM DUAL
UNION ALL
SELECT 'Биология' FROM DUAL
UNION ALL
SELECT 'Литература' FROM DUAL;

INSERT INTO BRANCHES(NAME)
SELECT 'Дневное' FROM DUAL
UNION ALL
SELECT 'Вечернее' FROM DUAL
UNION ALL
SELECT 'Заочное' FROM DUAL;

INSERT INTO ORDERS_ITEMS(NAME,ITEM_NUMBER)
SELECT 'Победители и призеры олимпиад', '1' FROM DUAL
UNION ALL
SELECT 'Имеющие льготы', '2' FROM DUAL
UNION ALL
SELECT 'Основной прием', '3' FROM DUAL;

INSERT INTO SPECIALTIES(NAME,CODE)
SELECT 'Прикладная математика и информатика', '01.03.02' FROM DUAL
UNION ALL
SELECT 'Информатика и вычислительная техника', '09.03.01' FROM DUAL
UNION ALL
SELECT 'Прикладная информатика', '09.03.03' FROM DUAL
UNION ALL
SELECT 'Программная инженерия', '09.03.04' FROM DUAL
UNION ALL
SELECT 'Информационная безопасность', '10.03.01' FROM DUAL
UNION ALL
SELECT 'Приборостроение', '12.03.01' FROM DUAL
UNION ALL
SELECT 'Оптотехника', '12.03.02' FROM DUAL
UNION ALL
SELECT 'Техническая физика', '16.03.01' FROM DUAL
UNION ALL
SELECT 'Менеджмент', '38.03.02' FROM DUAL
UNION ALL
SELECT 'Интеллектуальные системы в гуманитарной сфере', '45.03.04' FROM DUAL;

INSERT INTO DEPARTMENT_TYPES(NAME)
SELECT 'Университет' FROM DUAL
UNION ALL 
SELECT 'Факультет' FROM DUAL
UNION ALL
SELECT 'Кафедра' FROM DUAL;



INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Университет ИТМО',NULL, 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Университет'),777, 'ИТМО' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Естественно научный факультет', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=777), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Факультет'),100, 'ЕНФ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Факультет информационных технологий и программирования', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=777), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Факультет'), 150, 'ФИТиП' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Факультет компьютерных технологий и управления', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=777), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Факультет'), 200, 'ФКТиУ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Факультет фотоники и оптоинформатики', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=777), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Факультет'), 250, 'ФФиОИ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Факультет оптико-информационных систем и технологий', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=777), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Факультет'), 300, 'ФОИСТ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Инженерно физический факультет', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=777), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Факультет'), 350, 'ИФФ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Кафедра Высшей математики - 1', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=100), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Кафедра'), 101, 'ВМ-1' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Кафедра компьютерных технологий', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=150), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Кафедра'), 151, 'КТ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Кафедра вычислительной техники', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=200), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Кафедра'), 201, 'ВТ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Кафедра компьютерной фотоники и видеоинформатики', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=250), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Кафедра'), 251, 'КФиВИ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Кафедра информационных систем', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=150), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Кафедра'), 152, 'ИС' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Кафедра информатики и прикладной математики', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=200), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Кафедра'), 202, 'ИПМ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Кафедра безопасных информационных технологий', 
(SELECT ID FROM DEPARTMENTS WHERE CODE=200), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Кафедра'), 203, 'БИТ' FROM DUAL;
INSERT INTO DEPARTMENTS(NAME,DEPARTMENT_ID,DEPARTMENT_TYPE_ID, CODE, ABBR)
SELECT 'Кафедра интеллектуальных технологий в гуманитарной сфере',
(SELECT ID FROM DEPARTMENTS WHERE CODE=100), 
(SELECT ID FROM DEPARTMENT_TYPES WHERE NAME='Кафедра'), 102, 'ИТГС' FROM DUAL;


INSERT INTO PROGRAMS(SPEC_ID,BRANCH_ID)
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '01.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '01.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '01.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.03'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.03'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.03'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.04'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.04'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '09.03.04'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '10.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '10.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '10.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '12.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '12.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '12.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '12.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '12.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '12.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '16.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '16.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '16.03.01'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '38.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '38.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '38.03.02'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '45.03.04'),
(SELECT ID FROM BRANCHES WHERE NAME='Дневное') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '45.03.04'),
(SELECT ID FROM BRANCHES WHERE NAME='Вечернее') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM SPECIALTIES WHERE CODE = '45.03.04'),
(SELECT ID FROM BRANCHES WHERE NAME='Заочное') FROM DUAL;


INSERT INTO DEPARTMENTPROGRAM(PROGRAM_ID,DEPARTMENT_ID)
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='01.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВМ-1') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='01.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВМ-1') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='01.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВМ-1') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='01.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='01.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='01.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.01') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.01') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.01') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.03') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КФиВИ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.03') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КФиВИ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.03') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КФиВИ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.03') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИС') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.03') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИС') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.03') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИС') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.04') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИПМ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.04') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИПМ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='09.03.04') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИПМ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='10.03.01') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='10.03.01') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='10.03.01') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ВТ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='12.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КФиВИ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='12.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КФиВИ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='12.03.02') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='КФиВИ') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='45.03.04') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Дневное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИТГС') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='45.03.04') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Вечернее')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИТГС') FROM DUAL
UNION ALL
SELECT (SELECT ID FROM PROGRAMS WHERE SPEC_ID=
(SELECT ID FROM SPECIALTIES WHERE CODE='45.03.04') AND
BRANCH_ID = (SELECT ID FROM BRANCHES WHERE NAME='Заочное')),
(SELECT ID FROM DEPARTMENTS WHERE ABBR='ИТГС') FROM DUAL;

INSERT INTO CITIZENSHIP(NAME) VALUES('Россия');
INSERT INTO CITIZENSHIP(NAME) VALUES('Украина');
INSERT INTO CITIZENSHIP(NAME) VALUES('Казахстан');

INSERT INTO PRIORITIES(ENTRANT_ID,PROGRAM_ID,PRIORITY)
VALUES (100,10,1);