RelationalDesign: polnenje.sql

File polnenje.sql, 11.0 KB (added by 201051, 2 years ago)
Line 
1insert into administratori(a_ime, a_prezime, a_korisnicko_ime, a_email, a_lozinka)
2values
3 ('Lina', 'Nakova', 'admin1', 'lina.nakova@admin.com', 'admin'),
4 ('Angel', 'Nasev', 'admin2', 'angel.nasev@admin.com', 'admin'),
5 ('Katerina', 'Smileska', 'admin3', 'katerina.smileska@admin.com', 'admin');
6
7insert into studenti(s_ime, s_prezime, s_korisnicko_ime, s_email, s_lozinka, s_index)
8values
9 ('Lina', 'Nakova', 'lina.nakova', 'lina.nakova@students.finki.ukim.mk', 'linan201050', 201050),
10 ('Angel', 'Nasev', 'angel.nasev', 'angel.nasev@students.finki.ukim.mk', 'angeln201051', 201051),
11 ('Katerina', 'Smileska', 'katerina.smileska', 'katerina.smileska@students.finki.ukim.mk', 'katerinas201052', 201052);
12
13insert into profesori(p_ime, p_prezime, p_korisnicko_ime, p_email, p_lozinka)
14values
15 ('Vangel', 'Ajanovski', 'vangel.ajanovski', 'vangel.ajanovski@finki.ukim.mk', 'vangela'),
16 ('Nenad', 'Ancev', 'nenad.ancev', 'nenad.ancev@finki.ukim.mk', 'nenada'),
17 ('Sasho', 'Gramatikov', 'sasho.gramatikov', 'sasho.gramatikov@finki.ukim.mk', 'sashog'),
18 ('Goran', 'Velinov', 'goran.velinov', 'goran.velinov@finki.ukim.mk', 'goranv');
19
20insert into predmeti(pr_ime, a_id)
21values
22 ('Bazi na podatoci', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
23 ('Veb programiranje', (select a.a_id from administratori as a where a.a_korisnicko_ime = 'admin1')),
24 ('Kompjuterski mrezi i bezbednost', (select a.a_id from administratori as a where a.a_korisnicko_ime = 'admin1')),
25 ('Kompjuterska etika', (select a.a_id from administratori as a where a.a_korisnicko_ime = 'admin1'));
26
27insert into kursevi(ku_ime, ku_opis, pr_id)
28values
29 ('Bazi na podatoci - VA', 'Predmet na fakultetot finki', (select p.pr_id from predmeti as p where pr_ime = 'Bazi na podatoci')),
30 ('Bazi na podatoci - GV',null, (select p.pr_id from predmeti as p where pr_ime = 'Bazi na podatoci')),
31 ('Veb programiranje','Izucuvanje na tehnologiite na Spring', (select p.pr_id from predmeti as p where pr_ime = 'Veb programiranje'));
32
33insert into kategorii(ka_ime, ka_opis, a_id)
34values
35 ('Auditoriski vezbi', 'Prasanja povrzani so auditoriskite vezbi', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
36 ('Predavanja', 'Prasanja povrzani so predavanjata', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
37 ('Laboratoriski vezbi', 'Prasanja povrzani so laboratoriskite vezbi', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
38 ('Ispit', 'Prasanja povrzani so ispiti', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
39 ('Kolokvium', 'Prasanja povrzani so kolokvium', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1')),
40 ('Administracija', 'Prasanja povrzani so administracija', (select a.a_id from administratori as a where a.a_korisnicko_ime= 'admin1'));
41
42insert into prof_term_za_kons(p_id, termin)
43values
44 ((select p.p_id from profesori as p where p.p_korisnicko_ime = 'vangel.ajanovski'), '2022-12-12 10:00:00'),
45 ((select p.p_id from profesori as p where p.p_korisnicko_ime = 'vangel.ajanovski'), '2022-12-15 10:00:00'),
46 ((select p.p_id from profesori as p where p.p_korisnicko_ime = 'sasho.gramatikov'), '2022-12-10 9:30:00');
47
48insert into e_prof_na(p_id, ku_id)
49values
50 ((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')),
51 ((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')),
52 ((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'));
53
54insert into materijali(m_ime,p_id,ka_id,ku_id)
55values
56 ('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')),
57 ('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')),
58 ('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'));
59
60insert into prasanja(pra_naslov,pra_sodrzina,pra_datum,ku_id,s_id)
61values
62 ('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')),
63 ('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')),
64 ('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'));
65
66insert into odgovori(o_sodrzina,o_validen,o_datum,pra_id,s_id,p_id)
67values
68 ('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')),
69 ('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),
70 ('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'));
71
72insert into e_vo_vrska_so(pra_id,m_id)
73values
74 ((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')),
75 ((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')),
76 ((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'));
77
78insert into moze_da_slusa(s_id,ku_id)
79values
80 ((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')),
81 ((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')),
82 ((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')),
83 ((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')),
84 ((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')),
85 ((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'));
86
87insert into e_oznaceno_so(pra_id,ka_id)
88values
89 ((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')),
90 ((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')),
91 ((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')),
92 ((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'));
93
94insert into dava_reakcija(p_id,o_id,reakcija)
95values
96 ((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),
97 ((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),
98 ((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);
99
100insert into reagira_na(s_id,o_id,reakcija)
101values
102 ((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),
103 ((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),
104 ((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),
105 ((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);