RelationalDesign: vnesuvanjenew.sql

File vnesuvanjenew.sql, 3.7 KB (added by 201144, 16 months ago)
Line 
1-- Inserting data into city table
2INSERT INTO city (CityName)
3VALUES ('Skopje'),
4 ('Veles'),
5 ('Ohrid'),
6 ('Kumanovo'),
7 ('Stip');
8
9-- Inserting data into faculty table
10INSERT INTO faculty (FacultyName, CityID)
11VALUES ('FINKI', 1),
12 ('PMF', 1),
13 ('Gastronomija', 8);
14
15-- Inserting data into building table
16INSERT INTO building (CityID, BuildingAddress)
17VALUES (1, 'Blaze Koneski 10'),
18 (1, 'Gologanov 24'),
19 (8, 'Rade Koncar 1'),
20 (7, 'Gologanov 3'),
21 (12, 'Kiro Gligorov 3');
22
23-- Inserting data into appuser table
24INSERT INTO appuser (prezime, ime, Password, phone_number , email_address , username)
25VALUES ('Trajkovski', 'Filip', 'ft12', '111-111-111', 'test@mail.com', 'usernamet'),
26 ('Nikolovski', 'Blagoja', 'bn12', '111-111-111', 'test@mail.com', 'usernamen'),
27 ('Nikolov', 'Darko', 'dn23', '123-234-444', 'test@mail.com', 'usernamenn'),
28 ('Aleksandrov', 'Aleksandar', 'aa23', '222-222-222', 'test@mail.com','usernamea'),
29 ('Ristova', 'Ana', 'ar23', '444-222-111', 'test@mail.com','usernamer');
30
31-- Inserting data into apartment_owner table
32INSERT INTO apartment_owner (OwnerID)
33VALUES (1),
34 (3),
35 (4);
36
37-- Inserting data into administrator table
38INSERT INTO administrator (AdminID, AdminRole)
39VALUES (4, 'mod'),
40 (5, 'mod'),
41 (6, 'mod');
42
43-- Inserting data into student table
44INSERT INTO student (StudentID, FacultyID, Age, Gender)
45VALUES (3, 1, 21, 'male'),
46 (2, 1, 21, 'male');
47
48-- Inserting data into apartment table
49INSERT INTO apartment (BuildingID, OwnerID, ApartmentFloorAndRoomNumber, ApartmentSize)
50VALUES (1, 1, 'Vlez 4 Stan 3', '60m2'),
51 (2, 2, 'Vlez 1 Stan 12', '55m2'),
52 (3, 3, 'Vlez 3 Stan 6', '70m2');
53
54-- Inserting data into apartment_agreement table
55INSERT INTO apartment_agreement (ApartmentID, OwnerID, DateSigned, DateExpires, ApartmentRent)
56VALUES (4, 1, TO_DATE('10/09/2022', 'DD/MM/YYYY'), TO_DATE('30/06/2023', 'DD/MM/YYYY'), 250),
57 (5, 2, TO_DATE('10/09/2022', 'DD/MM/YYYY'), TO_DATE('30/06/2023', 'DD/MM/YYYY'), 300),
58 (4, 3, TO_DATE('10/09/2022', 'DD/MM/YYYY'), TO_DATE('30/06/2023', 'DD/MM/YYYY'), 250);
59
60-- Inserting data into student_signs table
61INSERT INTO student_signs (StudentID, AgreementID)
62VALUES (2, 3),
63 (1, 3);
64
65-- Inserting data into post table
66INSERT INTO post (CityID, NumberOfRoommates, Price, DatePosted, Description)
67VALUES ((SELECT CityID FROM city WHERE CityName = 'Skopje'), 2, 250, TO_DATE('10/09/2022', 'DD/MM/YYYY'), 'baram cimer'),
68 ((SELECT CityID FROM city WHERE CityName = 'Skopje'), 2, 300, TO_DATE('10/09/2022', 'DD/MM/YYYY'), 'izdavam stan'),
69 ((SELECT CityID FROM city WHERE CityName = 'Skopje'), 2, 300, TO_DATE('10/09/2022', 'DD/MM/YYYY'), 'izdavam stan'),
70 ((SELECT CityID FROM city WHERE CityName = 'Skopje'), 2, 300, TO_DATE('10/09/2022', 'DD/MM/YYYY'), 'baram cimer');
71
72-- Inserting data into owner_post table
73INSERT INTO owner_post (OwnerPostID, ApartmentID, OwnerID)
74VALUES (2, 3, 1),
75 (3, 2, 2),
76 (6, 4, 3);
77
78-- Inserting data into apartment_photos table
79INSERT INTO apartment_photos (PostID, PhotosURL)
80VALUES (2, 'link1'),
81 (3, 'link3'),
82 (6, 'link4');
83
84-- Inserting data into student_post table
85INSERT INTO student_post (StudentPostID, StudentID)
86VALUES (1, 1),
87 (4, 2),
88 (5, 2);
89
90-- Inserting data into moderates_posts_for table
91INSERT INTO moderates_posts_for (CityID, AdminID)
92VALUES ((SELECT CityID FROM city WHERE CityName = 'Skopje'), 4),
93 ((SELECT CityID FROM city WHERE CityName = 'Skopje'), 5),
94 ((SELECT CityID FROM city WHERE CityName = 'Stip'), 6);