Логички и физички дизајн - Креирање база податоци (со SQL DDL): dmlscript9.sql

File dmlscript9.sql, 5.7 KB (added by 201205, 30 hours ago)
Line 
1INSERT INTO AppUser (UserId, FirstName, LastName, Email, Username, Password, City, Neighborhood, Bio, Quote)
2VALUES (1, 'Ana', 'Aneva', 'ana.aneva@mail.com', 'anna3aneva', '123456', 'Skopje', 'Karpos', 'Avid reader', 'Be yourself; everyone else is already taken. - Oscar Wilde'),
3(2, 'Mila', 'Mileva', 'mila.mileva@mail.com', 'mileva00', '123123', 'Skopje', 'Kisela Voda', 'Scuba diver and instructor', NULL),
4(3, 'Marko', 'Markov', 'marko.markov@mail.com', 'mark2', '321321', 'Skopje', 'Centar', NULL, NULL),
5(4, 'Daniela', 'Daneva', 'danii@mail.com', 'danidani', '456465', 'Skopje', 'Cair', NULL, NULL),
6(5, 'Davor', 'Davorov', 'davorov@mail.com', 'davorov1', '123456', 'Skopje', 'Karpos', NULL, NULL);
7
8INSERT INTO Book (BookId, Title, Author, Language, ImageURL)
9VALUES (01, 'The First Fifteen Lives of Harry August', 'Claire North', 'English', 'https://www.google.mk/books/edition/The_First_Fifteen_Lives_of_Harry_August/AZShAQAAQBAJ?hl=en'),
10(2, 'Tomorrow, and Tomorrow, and Tomorrow', 'Gabrielle Zevin', 'English', 'https://www.google.mk/books/edition/Tomorrow_and_Tomorrow_and_Tomorrow/JrpHEAAAQBAJ?hl=en'),
11(3, 'The Midnight Library', 'Matt Haig', 'Spanish', 'https://www.google.mk/books/edition/The_Midnight_Library/exTZzQEACAAJ?hl=en'),
12(4, 'Daisy Jones & The Six', 'Taylor Jenkins Reid', 'French', NULL),
13(5, 'The Seven Husbands of Evelyn Hugo', 'Taylor Jenkins Reid', 'English', 'https://www.google.mk/books/edition/The_Seven_Husbands_of_Evelyn_Hugo/NdAmDwAAQBAJ?hl=en&gbpv=1&dq=The+Seven+Husbands+of+Evelyn+Hugo&printsec=frontcover');
14
15INSERT INTO BookISBN (BookISBNId, BookId, ISBN)
16VALUES (1, 1, '0-356-50257-0'),
17(2, 2, '0-356-50257-0'),
18(3, 3, '978-0593321201'),
19(4, 4, '0-323-12333-2'),
20(5, 5, '0-116-5577-1');
21
22INSERT INTO Genre (GenreId, BookId, Genre)
23VALUES (1, 1, 'Historical Fiction'),
24(2, 2, 'Adventure fiction'),
25(3, 3, 'Science fiction'),
26(4 ,4, 'Historical Fiction'),
27(5, 5, 'Historical Fiction');
28
29INSERT INTO Library (InventoryId, UserId, Availability, Condition)
30VALUES (1, 1, 'Not Available', 'New'),
31(2, 3, 'Available', 'Like New'),
32(3, 3, 'Reserved', 'Poor'),
33(4, 5, 'Not Available', 'Good'),
34(5, 5, 'Available', 'Like New');
35
36INSERT INTO ContainsLibraryBook(LibraryBookId, InventoryId, BookId)
37VALUES(1,1,1),
38(2,2,2),
39(3,3,3),
40(4,4,4),
41(5,5,5);
42
43INSERT INTO Wishlist (WishId, UserId, Priority)
44VALUES (1, 1, 'High'),
45(2, 2, NULL),
46(3, 3, NULL),
47(4, 4, 'Medium'),
48(5, 5, 'Low');
49
50INSERT INTO ContainsWishlistBook(WishlistBookId, WishId, BookId)
51VALUES(1,1,1),
52(2,2,2),
53(3,3,3),
54(4,4,4),
55(5,5,5);
56
57INSERT INTO BookRequest(RequestId, RequesterId, OwnerId, BookId, InventoryId, RequestStatus, RequestDate)
58VALUES (1, 1, 2, 1, 1, 'Approved', '2024-04-15'),
59(2, 1, 4, 3, 2, 'Pending', '2024-06-23'),
60(3, 3, 2, 2, 4, 'Approved', '2024-03-11'),
61(4, 2, 5, 3, 1, 'Pending', '2024-02-16'),
62(5, 3, 3, 4, 5, 'Declined', '2024-01-09');
63
64INSERT INTO Transaction (TransactionId, RequestId, BorrowerId, LenderId, InventoryId, BorrowDate, ReturnDate, BorrowDuration)
65VALUES (1, 1, 2, 3, 1, '2024-04-15', '2024-04-25', 10),
66(2, 2, 3, 2, 2, '2024-06-23', '2024-06-28', 5),
67(3, 3, 2, 1, 3, '2024-06-23', '2024-06-28', 5),
68(4, 4, 1, 2, 4, '2024-02-16', '2024-02-26', 10),
69(5, 5, 4, 5, 5, '2024-02-16', '2024-02-26', 10);
70
71INSERT INTO Swap(SwapId, TransactionId1, TransactionId2)
72VALUES(1, 2,3);
73
74INSERT INTO ExchangingBook ( TransactionBookId, TransactionId, BookId)
75VALUES (1, 1, 1),
76(2, 2, 2),
77(3, 3, 3),
78(4, 4, 4),
79(5, 5, 5);
80
81
82INSERT INTO Review (ReviewId, TransactionId, ReceiverId, GiverId, Rating, ReviewerComment, ReviewDate)
83VALUES (1, 1, 2, 1, 5, 'They were great!', '2025-10-10'),
84(2, 2, 3, 2, 4, 'Returned my book on time!', '2025-02-22'),
85(3, 3, 4, 1, 5, NULL, '2025-11-12'),
86(4, 4, 2, 2, 1, 'Destoryed my book!', '2025-04-25'),
87(5, 5, 5, 4, 5, NULL, '2025-02-01');
88
89INSERT INTO Message (MessageId, SenderId, ReceiverId, MsgTime, MsgDate, MessageContent)
90VALUES ( 1, 1, 2, '14:34:54', '2024-05-01' , 'Hi! I finished the book early!'),
91( 2, 2, 1, '22:14:47', '2024-03-08' , 'Did you like Daisy Jones?'),
92( 3, 3, 2, '12:02:04', '2024-05-01' , 'I did not get to read it yet.'),
93( 4, 4, 2, '11:53:11', '2024-05-21' , 'Would you consider buying the hardcover?'),
94( 5, 5, 4, '23:34:32', '2024-05-07' , 'I love this book!');
95
96
97INSERT INTO FriendRequest (FriendshipId, SenderId, ReceiverId, DateCreated, FriendshipStatus)
98VALUES (1, 2, 1, '2025-01-01', 'Accepted'),
99(2, 2, 3, '2025-02-04', 'Accepted'),
100(3, 3, 4, '2025-03-05', 'Declined'),
101(4, 1, 4, '2025-04-09', 'Blocked'),
102(5, 5, 2, '2025-04-11', 'Pending');
103
104INSERT INTO Report (ReportId, ReportedUserId, ReportingUserId, ReportType, ReportDate, Details, ReportStatus, ReportedEntity)
105VALUES (1, 2, 1, 'Harassment', '2025-01-05', NULL, 'Accepted', 'Message'),
106(2, 3, 2, 'Harassment', '2025-02-04', NULL, 'Pending', 'Rating'),
107(3, 1, 5, 'Bullying', '2025-03-08', NULL, 'Rejected', 'Profile'),
108(4, 4, 2, 'Hate speech', '2025-05-09', 'Example text', 'Resolved', 'Message'),
109(5, 5, 3, 'Spamming', '2025-06-21', 'Example text', 'Pending', 'Library');
110
111INSERT INTO Notification (NotificationId, TransactionId, MessageId, FriendRequestId, BookRequestId, Type, NotifTime, NotifDate, Description, NotificationStatus)
112VALUES (1, 1, NULL, NULL, NULL, 'Transaction', '14:34:54', '2025-01-02', 'Ongoing Transaction!', 'Unread'),
113(2, NULL, NULL, NULL, NULL, 'System Update', '22:14:47', '2025-02-03', 'System update!', 'Dismissed'),
114(3, NULL, 2, NULL, NULL, 'Message', '12:02:04', '2025-03-04', 'Anya sent you a message!', 'Unread'),
115(4, NULL, NULL, 3, NULL, 'Friend Request', '11:53:11', '2025-04-01', 'Sonny sent you a friend request!', 'Read'),
116(5, NULL, NULL, NULL, 4, 'Book Request', '23:34:32', '2025-07-27', 'Elena sent you a book request!', 'Unread');
117
118INSERT INTO ReceivesNotification (UserNotificationId, UserId, NotificationId)
119VALUES (1, 1, 1),
120(2, 2, 2),
121(3, 3, 3),
122(4, 4, 4),
123(5, 5, 5);
124