insert into administratori(a_ime, a_prezime, a_korisnicko_ime, a_email, a_lozinka)
values 
	('Lina', 'Nakova', 'admin1', 'lina.nakova@admin.com', 'admin'),
	('Angel', 'Nasev', 'admin2', 'angel.nasev@admin.com', 'admin'),
	('Katerina', 'Smileska', 'admin3', 'katerina.smileska@admin.com', 'admin');

insert into studenti(s_ime, s_prezime, s_korisnicko_ime, s_email, s_lozinka, s_index)
values
	('Lina', 'Nakova', 'lina.nakova', 'lina.nakova@students.finki.ukim.mk', 'linan201050', 201050),
	('Angel', 'Nasev', 'angel.nasev', 'angel.nasev@students.finki.ukim.mk', 'angeln201051', 201051),
    ('Katerina', 'Smileska', 'katerina.smileska', 'katerina.smileska@students.finki.ukim.mk', 'katerinas201052', 201052);

insert into profesori(p_ime, p_prezime, p_korisnicko_ime, p_email, p_lozinka)
values
	('Vangel', 'Ajanovski', 'vangel.ajanovski', 'vangel.ajanovski@finki.ukim.mk', 'vangela'),
    ('Nenad', 'Ancev', 'nenad.ancev', 'nenad.ancev@finki.ukim.mk', 'nenada'),
    ('Sasho', 'Gramatikov', 'sasho.gramatikov', 'sasho.gramatikov@finki.ukim.mk', 'sashog'),
   	('Goran', 'Velinov', 'goran.velinov', 'goran.velinov@finki.ukim.mk', 'goranv');

insert into predmeti(pr_ime, a_id)
values
    ('Bazi na podatoci', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
    ('Veb programiranje', (select a.a_id from administratori as a where a.a_korisnicko_ime = 'admin1')),
    ('Kompjuterski mrezi i bezbednost', (select a.a_id from administratori as a where a.a_korisnicko_ime = 'admin1')),
    ('Kompjuterska etika', (select a.a_id from administratori as a where a.a_korisnicko_ime = 'admin1'));

insert into kursevi(ku_ime, ku_opis, pr_id)
values 
	('Bazi na podatoci - VA', 'Predmet na fakultetot finki', (select p.pr_id from predmeti as p where pr_ime = 'Bazi na podatoci')),
 	('Bazi na podatoci - GV',null, (select p.pr_id from predmeti as p where pr_ime = 'Bazi na podatoci')),
 	('Veb programiranje','Izucuvanje na tehnologiite na Spring', (select p.pr_id from predmeti as p where pr_ime = 'Veb programiranje'));

insert into kategorii(ka_ime, ka_opis, a_id)
values
    ('Auditoriski vezbi', 'Prasanja povrzani so auditoriskite vezbi', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
    ('Predavanja', 'Prasanja povrzani so predavanjata', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
    ('Laboratoriski vezbi', 'Prasanja povrzani so laboratoriskite vezbi', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
    ('Ispit', 'Prasanja povrzani so ispiti', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
    ('Kolokvium', 'Prasanja povrzani so kolokvium', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
    ('Administracija', 'Prasanja povrzani so administracija', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1'));

insert into prof_term_za_kons(ptk_id, p_id, termin)
values (0, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'vangel.ajanovski'),
        '2022-12-12 10:00:00'),
       (1, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'vangel.ajanovski'),
        '2022-12-15 10:00:00'),
       (2, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'sasho.gramatikov'),
        '2022-12-10 9:30:00');
		
insert into e_prof_na(pn_id, p_id, ku_id)
values (0, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'vangel.ajanovski'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - VA')),
       (1, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'sasho.gramatikov'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Veb programiranje')),
       (2, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'goran.velinov'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - GV'));

insert into materijali(m_ime,p_id,ka_id,ku_id)
values
	('Database System Concepts',(select p.p_id from profesori as p where p.p_korisnicko_ime = 'vangel.ajanovski'),(select ka.ka_id from kategorii as ka where ka.ka_ime = 'Predavanja'),(select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - VA')),
	('Spring Data Persistence',(select p.p_id from profesori as p where p.p_korisnicko_ime = 'sasho.gramatikov'),(select ka.ka_id from kategorii as ka where ka.ka_ime = 'Predavanja'),(select ku.ku_id from kursevi as ku where ku.ku_ime = 'Veb programiranje')),
	('Mapiracka Transformacija',(select p.p_id from profesori as p where p.p_korisnicko_ime = 'nenad.ancev'),(select ka.ka_id from kategorii as ka where ka.ka_ime = 'Auditoriski vezbi'),(select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - VA'));
	
insert into prasanja(pra_naslov,pra_sodrzina,pra_datum,ku_id,s_id)
values
	('Kako da ponistam transakcija','Koristev transakcija za izvrsuvanje nekolku naredbi, no edna od niv bese neuspesna. Sega kako mozam da se vratam na sostojbata pred zapocnuvanjeto na transakcijata?','2022-12-05 20:38:00',(select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - VA'),(select s.s_id from studenti as s where s.s_korisnicko_ime='angel.nasev')),
	('Tip na podatok za datoteki vo PostgreSQL','Sakam vo mojot proekt da dodadam atribut koj ke cuva datoteka. Kako mozam da go napravam toa?','2022-12-03 10:00:00',(select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - VA'),(select s.s_id from studenti as s where s.s_korisnicko_ime='lina.nakova')),
	('Ne mozam da pristapam do delot za rabota so bazi vo IntelliJ','Vo auditoriskite vezbi, profesorot ima kopce na koe moze da gi gleda site tabeli i semata na bazata. Kaj mene toa kopce ne postoi. Sto e problemot? Kako bi go resil?','2022-12-01 12:30:00',(select ku.ku_id from kursevi as ku where ku.ku_ime = 'Veb programiranje'),(select s.s_id from studenti as s where s.s_korisnicko_ime='katerina.smileska'));
	
insert into odgovori(o_sodrzina,o_validen,o_datum,pra_id,s_id,p_id)
values
	('Dobar nacin za cuvanje datoteki e ako se koristi atribut od tip text koj ke sodrzi pateka do dokumentot',true,'2022-12-03 17:45:00',(select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Tip na podatok za datoteki vo PostgreSQL'),null,(select p.p_id from profesori as p where p.p_korisnicko_ime = 'nenad.ancev')),
	('Za vrakanje na prvicnata sostojba treba da se koristi rollback komandata',false,'2022-12-06 08:05:00',(select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Kako da ponistam transakcija'),(select s.s_id from studenti as s where s.s_korisnicko_ime='lina.nakova'),null),
	('Ovaa funkcionalnost e dostapna samo kaj IntelliJ Ultimate. Mozete da go koristite besplatno so vnesuvanje na vasiot studentski mail',true,'2022-12-03 15:27:00',(select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Ne mozam da pristapam do delot za rabota so bazi vo IntelliJ'),null,(select p.p_id from profesori as p where p.p_korisnicko_ime = 'sasho.gramatikov'));
	
insert into e_vo_vrska_so(vs_id, pra_id, m_id)
values (0, (select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Kako da ponistam transakcija'), (select m.m_id from materijali as m where m.m_ime = 'Database System Concepts')),
       (1, (select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Ne mozam da pristapam do delot za rabota so bazi vo IntelliJ'), (select m.m_id from materijali as m where m.m_ime = 'Spring Data Persistence')),
       (2, (select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Tip na podatok za datoteki vo PostgreSQL'), (select m.m_id from materijali as m where m.m_ime = 'Database System Concepts'));
	
insert into moze_da_slusa(mds_id, s_id, ku_id)
values (0, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'angel.nasev'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - VA')),
       (1, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'angel.nasev'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Veb programiranje')),
       (2, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'lina.nakova'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - VA')),
       (3, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'lina.nakova'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Veb programiranje')),
       (4, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'katerina.smileska'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Bazi na podatoci - GV')),
       (5, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'katerina.smileska'), (select ku.ku_id from kursevi as ku where ku.ku_ime = 'Veb programiranje'));
	
insert into e_oznaceno_so(os_id, pra_id, ka_id)
values (0, (select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Tip na podatok za datoteki vo PostgreSQL'), (select ka.ka_id from kategorii as ka where ka.ka_ime = 'Auditoriski vezbi')), 
	   (1, (select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Tip na podatok za datoteki vo PostgreSQL'), (select ka.ka_id from kategorii as ka where ka.ka_ime = 'Laboratoriski vezbi')),
       (2, (select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Kako da ponistam transakcija'), (select ka.ka_id from kategorii as ka where ka.ka_ime = 'Predavanja')),
       (3, (select pra.pra_id from prasanja as pra where pra.pra_naslov = 'Ne mozam da pristapam do delot za rabota so bazi vo IntelliJ'), (select ka.ka_id from kategorii as ka where ka.ka_ime = 'Auditoriski vezbi'));

insert into dava_reakcija(dr_id, p_id, o_id, reakcija)
values (0, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'vangel.ajanovski'),
        (select o.o_id from odgovori as o where o.o_sodrzina = 'Dobar nacin za cuvanje datoteki e ako se koristi atribut od tip text koj ke sodrzi pateka do dokumentot'), true),
       (1, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'vangel.ajanovski'),
	    (select o.o_id from odgovori as o where o.o_sodrzina = 'Za vrakanje na prvicnata sostojba treba da se koristi rollback komandata'), true),
       (2, (select p.p_id from profesori as p where p.p_korisnicko_ime = 'goran.velinov'),
	    (select o.o_id from odgovori as o where o.o_sodrzina = 'Dobar nacin za cuvanje datoteki e ako se koristi atribut od tip text koj ke sodrzi pateka do dokumentot'), true);

insert into reagira_na(rn_id, s_id, o_id, reakcija)
values (0, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'angel.nasev'), (select o.o_id from odgovori as o where o.o_sodrzina = 'Ovaa funkcionalnost e dostapna samo kaj IntelliJ Ultimate. Mozete da go koristite besplatno so vnesuvanje na vasiot studentski mail'), false),
       (1, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'lina.nakova'), (select o.o_id from odgovori as o where o.o_sodrzina = 'Ovaa funkcionalnost e dostapna samo kaj IntelliJ Ultimate. Mozete da go koristite besplatno so vnesuvanje na vasiot studentski mail'), true),
       (2, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'angel.nasev'), (select o.o_id from odgovori as o where o.o_sodrzina = 'Dobar nacin za cuvanje datoteki e ako se koristi atribut od tip text koj ke sodrzi pateka do dokumentot'), true),
       (3, (select s.s_id from studenti as s where s.s_korisnicko_ime = 'katerina.smileska'), (select o.o_id from odgovori as o where o.o_sodrzina = 'Za vrakanje na prvicnata sostojba treba da se koristi rollback komandata'), true);