RelationalDesign: polnenje.sql

File polnenje.sql, 10.6 KB (added by 216049, 11 months ago)
Line 
1set search_path = project;
2
3INSERT INTO Korisnik (k_ime, k_adresa, k_telefon, k_email, k_embg, k_is_admin, k_lozinka)
4VALUES
5 ('Pavel Paunovski', 'Aerodrom 123', '075500000', 'john.doe@example.com', '1610002450450', false, 'pp'),
6 ('Darko Sekulovski', 'Gjorce 123', '076500000', 'jane.smith@example.com', '0403002450450', false, 'ds'),
7 ('Petar Gruevski', 'Dracevo 123', '077500000', 'bob.johnson@example.com', '1305002450450', false, 'pg'),
8 ('Vangel Ajanovski', 'Finki 123', '078500000', 'bob.johnson@example.com', '1212975450450', true, 'va');
9
10
11INSERT INTO Patnik (k_id) VALUES (1);
12
13
14
15INSERT INTO Vraboten (k_id, v_plata, v_datum_na_vrabotuvanje, v_datum_prekin_vrabotuvanje)
16VALUES
17 (2, 70000.00, '2020-04-01', NULL),
18 (3, 65000.00, '2020-05-01', NULL);
19
20
21
22INSERT INTO Vozac (k_id) VALUES (3);
23insert into Kondukter(k_id) values (2);
24
25--INSERT INTO Dokument (d_broj_na_dokumnet, d_datum_na_izdavanje, d_datum_ist, d_koj_go_izdal, l_id)
26--VALUES
27-- ('ABC123', '2023-01-01', '2023-12-31', 'Government', 1),
28-- ('XYZ456', '2023-02-01', '2023-11-30', 'Company XYZ', 2),
29-- ('123DEF', '2023-03-01', '2023-10-31', 'Authority ABC', 3);
30
31INSERT INTO Avtobus (a_registracija, a_seriski_broj, a_broj_sedista)
32VALUES
33 ('ABC12345', 'ABC987654', 50),
34 ('XYZ54321', 'XYZ123456', 45),
35 ('123ABCD', '123XYZ789', 55),
36 ('456DEFG', '456XYZ789', 40),
37 ('789HIJK', '789XYZ123', 60);
38
39INSERT INTO Linija (li_id, li_ime, li_pravec)
40VALUES
41(1, 'Line 1', 'Aerodrom-Gjorce'),
42(2, 'Line 1', 'Gjorce-Aerodrom'),
43(3, 'Line 2', 'Gjorce-Dracevo'),
44(4, 'Line 2', 'Dracevo-Gjorce'),
45(5, 'Line 3', 'Dracevo-Aerodrom'),
46(6, 'Line 3', 'Aerodrom-Dracevo'),
47(7, 'Line 4', 'Butel-Centar'),
48(8, 'Line 4', 'Centar-Butel'),
49(9, 'Line 5', 'Vodno-Chair'),
50(10, 'Line 5', 'Chair-Vodno');
51
52INSERT INTO InstancaNaLinija (inl_datum_start, inl_datum_end, vozac_k_id, a_registracija, li_id)
53VALUES
54 ('2023-01-01 12:00:00', '2023-01-01 13:00:00', 3, 'ABC12345', 1),
55 ('2023-02-01 12:00:00', '2023-02-01 13:00:00', 3, 'XYZ54321', 2),
56 ('2023-03-01 12:00:00', '2023-03-01 13:00:00', 3, '123ABCD', 3),
57 ('2023-04-01 12:00:00', '2023-04-01 13:00:00', 3, '456DEFG', 4),
58 ('2023-05-01 12:00:00', '2023-05-01 13:00:00', 3, '789HIJK', 5);
59
60INSERT INTO Mesto (m_grad, m_opstina, m_ulica)
61VALUES
62 ('Skopje', 'Aerodrom', 'Lake Street 2'),
63 ('Skopje', 'Aerodrom', 'Mountain Street 3'),
64 ('Skopje', 'Aerodrom', 'Valley Street 4'),
65 ('Skopje', 'Aerodrom', 'River Street 5'),
66 ('Skopje', 'Aerodrom', 'Mountain Avenue 12'),
67 ('Skopje', 'Aerodrom', 'Valley Lane 8'),
68 ('Skopje', 'Aerodrom', 'Ocean View 3'),
69 ('Skopje', 'Aerodrom', 'Forest Drive 7'),
70 ('Skopje', 'Aerodrom', 'Sunset Boulevard 10'),
71 ('Skopje', 'Aerodrom', 'Meadow Street 21'),
72 ('Skopje', 'Aerodrom', 'Highland Place 14'),
73 ('Skopje', 'Aerodrom', 'Hillside Road 19'),
74 ('Skopje', 'Aerodrom', 'Lake Shore 6'),
75 ('Skopje', 'Aerodrom', 'Park Avenue 25'),
76 ('Skopje', 'Aerodrom', 'Creek Side 17'),
77 ('Skopje', 'Aerodrom', 'Greenway 4'),
78 ('Skopje', 'Aerodrom', 'Ridge Street 11'),
79 ('Skopje', 'Aerodrom', 'Harbor View 9'),
80 ('Skopje', 'Aerodrom', 'Maple Lane 13'),
81 ('Skopje', 'Aerodrom', 'Pinecrest 16'),
82 ('Skopje', 'Centar', 'Mountain Ridge 5'),
83 ('Skopje', 'Centar', 'Valley Court 8'),
84 ('Skopje', 'Centar', 'Riverfront Avenue 11'),
85 ('Skopje', 'Centar', 'Forest View 7'),
86 ('Skopje', 'Centar', 'Sunset Plaza 10'),
87 ('Skopje', 'Centar', 'Meadow Lane 21'),
88 ('Skopje', 'Centar', 'Highland Terrace 14'),
89 ('Skopje', 'Centar', 'Hillside Place 19'),
90 ('Skopje', 'Centar', 'Lakeview Drive 6'),
91 ('Skopje', 'Centar', 'Parkside Circle 25'),
92 ('Skopje', 'Centar', 'Creek Road 17'),
93 ('Skopje', 'Centar', 'Greenwood Street 4'),
94 ('Skopje', 'Centar', 'Ridgeview Court 13'),
95 ('Skopje', 'Centar', 'Harbor Lane 9'),
96 ('Skopje', 'Centar', 'Maple Grove 16'),
97 ('Skopje', 'Centar', 'Pineview Avenue 22'),
98 ('Skopje', 'Centar', 'Riverside Terrace 18'),
99 ('Skopje', 'Centar', 'Blossom Lane 23'),
100 ('Skopje', 'Centar', 'Winding Street 20'),
101 ('Skopje', 'Centar', 'Sunnyvale Place 15'),
102 ('Skopje', 'Karposh', 'Mountain Summit 27'),
103 ('Skopje', 'Karposh', 'Valley Heights 33'),
104 ('Skopje', 'Karposh', 'River Bend 41'),
105 ('Skopje', 'Karposh', 'Forest Grove 29'),
106 ('Skopje', 'Karposh', 'Sunset Ridge 36'),
107 ('Skopje', 'Karposh', 'Meadow Haven 45'),
108 ('Skopje', 'Karposh', 'Highland Crest 38'),
109 ('Skopje', 'Karposh', 'Hilltop View 43'),
110 ('Skopje', 'Karposh', 'Lakefront Lane 30'),
111 ('Skopje', 'Karposh', 'Parkview Terrace 55'),
112 ('Skopje', 'Karposh', 'Creek Side 47'),
113 ('Skopje', 'Karposh', 'Greenfield Place 24'),
114 ('Skopje', 'Karposh', 'Ridgecrest Court 35'),
115 ('Skopje', 'Karposh', 'Harbor Side 39'),
116 ('Skopje', 'Karposh', 'Maple Heights 46'),
117 ('Skopje', 'Karposh', 'Pinecrest Lane 52'),
118 ('Skopje', 'Karposh', 'Riverside Court 48'),
119 ('Skopje', 'Karposh', 'Blossom View 53'),
120 ('Skopje', 'Karposh', 'Winding Path 50'),
121 ('Skopje', 'Karposh', 'Sunnyvale Ridge 37')
122 ;
123
124INSERT INTO Postojka (p_id, p_ime, m_id)
125VALUES
126 (1, 'Station 1', 1),
127 (2, 'Station 2', 2),
128 (3, 'Station 3', 3),
129 (4, 'Station 4', 4),
130 (5, 'Station 5', 5),
131 (6, 'Station 6', 6),
132 (7, 'Station 7', 7),
133 (8, 'Station 8', 8),
134 (9, 'Station 9', 9),
135 (10, 'Station 10', 10),
136 (11, 'Station 11', 11),
137 (12, 'Station 12', 12),
138 (13, 'Station 13', 13),
139 (14, 'Station 14', 14),
140 (15, 'Station 15', 15),
141 (16, 'Station 16', 16),
142 (17, 'Station 17', 17),
143 (18, 'Station 18', 18),
144 (19, 'Station 19', 19),
145 (20, 'Station 20', 20),
146 (21, 'Station 21', 21),
147 (22, 'Station 22', 22),
148 (23, 'Station 23', 23),
149 (24, 'Station 24', 24),
150 (25, 'Station 25', 25),
151 (26, 'Station 26', 26),
152 (27, 'Station 27', 27),
153 (28, 'Station 28', 28),
154 (29, 'Station 29', 29),
155 (30, 'Station 30', 30),
156 (31, 'Station 31', 31),
157 (32, 'Station 32', 32),
158 (33, 'Station 33', 33),
159 (34, 'Station 34', 34),
160 (35, 'Station 35', 35),
161 (36, 'Station 36', 36),
162 (37, 'Station 37', 37),
163 (38, 'Station 38', 38),
164 (39, 'Station 39', 39),
165 (40, 'Station 40', 40),
166 (41, 'Station 41', 41),
167 (42, 'Station 42', 42),
168 (43, 'Station 43', 43),
169 (44, 'Station 44', 44),
170 (45, 'Station 45', 45),
171 (46, 'Station 46', 46),
172 (47, 'Station 47', 47),
173 (48, 'Station 48', 48),
174 (49, 'Station 49', 49),
175 (50, 'Station 50', 50),
176 (51, 'Station 51', 51),
177 (52, 'Station 52', 52),
178 (53, 'Station 53', 53),
179 (54, 'Station 54', 54),
180 (55, 'Station 55', 55),
181 (56, 'Station 56', 56),
182 (57, 'Station 57', 57),
183 (58, 'Station 58', 58),
184 (59, 'Station 59', 59),
185 (60, 'Station 60', 60);
186
187INSERT INTO PostojkaNaLinija (pnl_reden_broj, li_id, p_id)
188VALUES
189(1, 1, 1),
190(2, 1, 2),
191(3, 1, 3),
192(4, 1, 4),
193(5, 1, 5),
194(6, 1, 6),
195(7, 1, 7),
196(8, 1, 8),
197(9, 1, 9),
198(10, 1, 10),
199(11, 1, 11),
200(12, 1, 12),
201(13, 1, 13),
202(14, 1, 14),
203(14, 1, 60),
204(13, 1, 58),
205(12, 1, 56),
206(11, 1, 54),
207(10, 1, 52),
208(9, 1, 50),
209(8, 1, 48),
210(7, 1, 46),
211(6, 1, 44),
212(5, 1, 42),
213(4, 1, 40),
214(3, 1, 38),
215(2, 1, 36),
216(1, 1, 34),
217(1, 2, 1),
218(2, 2, 4),
219(3, 2, 7),
220(4, 2, 10),
221(5, 2, 13),
222(6, 2, 16),
223(7, 2, 19),
224(8, 2, 22),
225(9, 2, 25),
226(10, 2, 28),
227(11, 2, 31),
228(12, 2, 34),
229(13, 2, 37),
230(14, 2, 40),
231(10, 2, 60),
232(9, 2, 58),
233(8, 2, 56),
234(7, 2, 54),
235(6, 2, 52),
236(5, 2, 50),
237(4, 2, 48),
238(3, 2, 46),
239(2, 2, 44),
240(1, 2, 42),
241(1, 3, 1),
242(2, 3, 4),
243(3, 3, 7),
244(4, 3, 10),
245(5, 3, 13),
246(6, 3, 16),
247(7, 3, 19),
248(8, 3, 22),
249(9, 3, 25),
250(10, 3, 28),
251(11, 3, 31),
252(12, 3, 34),
253(12, 3, 60),
254(11, 3, 56),
255(10, 3, 52),
256(9, 3, 48),
257(8, 3, 44),
258(7, 3, 40),
259(6, 3, 36),
260(5, 3, 32),
261(4, 3, 28),
262(3, 3, 24),
263(2, 3, 20),
264(1, 3, 16),
265(1, 4, 1),
266(2, 4, 5),
267(3, 4, 9),
268(4, 4, 13),
269(5, 4, 17),
270(6, 4, 21),
271(7, 4, 25),
272(8, 4, 29),
273(9, 4, 33),
274(10, 4, 37),
275(11, 4, 41),
276(12, 4, 45),
277(13, 4, 60),
278(12, 4, 59),
279(11, 4, 58),
280(10, 4, 57),
281(9, 4, 56),
282(8, 4, 55),
283(7, 4, 54),
284(6, 4, 53),
285(5, 4, 52),
286(4, 4, 51),
287(3, 4, 50),
288(2, 4, 49),
289(1, 4, 48),
290(1, 5, 1),
291(2, 5, 3),
292(3, 5, 5),
293(4, 5, 7),
294(5, 5, 9),
295(6, 5, 11),
296(7, 5, 13),
297(8, 5, 15),
298(9, 5, 17),
299(10, 5, 19),
300(14, 5, 60),
301(13, 5, 57),
302(12, 5, 54),
303(11, 5, 51),
304(10, 5, 48),
305(9, 5, 45),
306(8, 5, 42),
307(7, 5, 39),
308(6, 5, 36),
309(5, 5, 33),
310(4, 5, 30),
311(3, 5, 27),
312(2, 5, 24),
313(1, 5, 21);
314
315
316
317
318
319INSERT INTO TipBilet (tb_id, tb_trajnost, tb_ime)
320VALUES
321 (1, 3600, 'Часовен'),
322 (2, 86400, 'Дневен'),
323 (3, 604800, 'Неделен'),
324 (4, 2419200, 'Месечен'),
325 (5, 29030400, 'Годишен');
326
327INSERT INTO Bilet (b_datum_na_kupuvanje, b_status, patnik_k_id, tb_id)
328VALUES
329 ('2023-01-01 08:30:00', 'INACTIVE', 1, 1),
330 ('2023-02-01 09:30:00', 'INACTIVE', 1, 2),
331 ('2023-03-01 10:30:00', 'INACTIVE', 1, 3),
332 ('2023-04-01 11:30:00', 'INACTIVE', 1, 4),
333 ('2023-05-01 12:30:00', 'INACTIVE', 1, 5);
334
335-- TODO: DA SE STAVI TRIGGER ZA KOGA SE KUCA (STARTUVA VOZENJE) DA SE UPDATE-NE STATUSOT VO ACTIVE AKO VEKE NE E ACTIVE!!!!!!!!!
336
337INSERT INTO Vozenje (vozenje_start, vozenje_end, patnik_k_id, kacuva_pnl_id, inl_id, b_id, vozenje_status)
338VALUES
339 ('2023-01-01 08:00:00', '2023-01-01 10:00:00', 1, 1, 1, 1, 'ACTIVE'),
340 ('2023-02-01 09:00:00', '2023-02-01 11:00:00', 1, 30, 2, 2, 'ACTIVE'),
341 ('2023-03-01 10:00:00', '2023-03-01 12:00:00', 1, 66, 3, 3, 'ACTIVE'),
342 ('2023-04-01 11:00:00', '2023-04-01 13:00:00', 1, 100, 4, 4, 'ACTIVE'),
343 ('2023-05-01 12:00:00', '2023-05-01 14:00:00', 1, 122, 5, 5, 'ACTIVE');
344
345INSERT INTO Kontroli (kontrola_datum, kondukter_k_id, inl_id)
346VALUES
347 ('2023-01-01 12:10:00', 2, 1),
348 ('2023-02-01 12:01:00', 2, 2),
349 ('2023-03-01 12:20:00', 2, 3),
350 ('2023-04-01 12:08:00', 2, 4),
351 ('2023-05-01 12:33:00', 2, 5);
352
353INSERT INTO Kazna (kz_iznos, kz_plateno, kz_datum, kondukter_k_id, kontrola_id, kz_datum_plateno, kz_dokument)
354VALUES
355 (100.00, false, '2023-01-01', 2, 1, null, 'A12345'),
356 (150.00, false, '2023-02-01', 2, 2, null, 'C12345');
357
358insert into KaznaZaRegistriran(kz_id, patnik_k_id)
359values
360 (1, 1);
361
362insert into KaznaZaNeregistriran(kz_id, kzn_telefon, kzn_ime, kzn_adresa)
363values
364 (2, '075111222', 'Stojko Neregistriranovski', 'ulica Rugjer Boshkovikj 12');
365
366--INSERT INTO Se_validira (vozenje_id, b_id)
367--VALUES
368-- (3, 3),
369-- (4, 4),
370-- (5, 5);
371
372INSERT INTO Se_simnuva_na (pnl_id, vozenje_id)
373VALUES
374 (8, 1),
375 (35, 2),
376 (70, 3),
377 (102, 4),
378 (125, 5);