2 | | * [wiki:Normalization001 Прв Чекор] |
3 | | * [wiki:Normalization002 Втор Чекор] |
| 3 | === Почетна релација: |
| 4 | |
| 5 | R(!UserId, !FirstName, !LastName, Email, Username, Password, City, Neighborhood, Bio, Quote, !BookId, Title, Author, Language, !ImageURL, !BookISBNId, ISBN, !GenreId, Genre, !InventoryId, Availability, Condition, !WishId, Priority, !RequestId, !RequestStatus, !RequestDate, !TransactionId, !BorrowDate, !ReturnDate, !BorrowDuration, !SwapId, !ReviewId, Rating, !ReviewerComment, !ReviewDate, !MessageId, !MsgTime, !MsgDate, !MessageContent, !FriendshipId, !DateCreated, !FriendshipStatus, !ReportId, !ReportType, !ReportDate, Details, !ReportStatus, !ReportedEntity, !NotificationId, Type, !NotifTime, !NotifDate, Description, !NotificationStatus) |
| 6 | |
| 7 | |
| 8 | === Функционални зависности: |
| 9 | |
| 10 | !UserId -> !FirstName, !LastName, Email, Username, Password, City, Neighborhood, Bio, Quote |
| 11 | |
| 12 | Email -> !UserId, !FirstName, !LastName, Username, Password, City, Neighborhood, Bio, Quote |
| 13 | |
| 14 | Username -> !UserId, !FirstName, !LastName, Email, Password, City, Neighborhood, Bio, Quote |
| 15 | |
| 16 | !BookId -> Title, Author, Language, !ImageURL |
| 17 | |
| 18 | !BookISBNId -> !BookId, ISBN |
| 19 | |
| 20 | !GenreId -> !BookId, Genre |
| 21 | |
| 22 | !InventoryId-> !UserId, Availability, Condition, !BookId |
| 23 | |
| 24 | !WishId -> !UserId, Priority, !BookId |
| 25 | |
| 26 | !RequestId -> !UserId, !BookId, !InventoryId, !RequestStatus, !RequestDate |
| 27 | |
| 28 | !TransactionId -> !RequestId, !UserId, !InventoryId, !BorrowDate, !ReturnDate, !BorrowDuration |
| 29 | |
| 30 | !SwapId -> !TransactionId |
| 31 | |
| 32 | !ReviewId -> !TransactionId, !UserId, Rating, !ReviewerComment, !ReviewDate |
| 33 | |
| 34 | !MessageId -> !UserId, !MsgTime, !MsgDate, !MessageContent |
| 35 | |
| 36 | !FriendshipId -> !UserId, !DateCreated, !FriendshipStatus |
| 37 | |
| 38 | !ReportId -> !UserId, !ReportType, !ReportDate, Details, !ReportStatus, !ReportedEntity |
| 39 | |
| 40 | Notification -> !NotificationId, !TransactionId, !MessageId, !FriendshipId, !RequestId, Type, !NotifTime, !NotifDate, Description, !NotificationStatus |
| 41 | |
| 42 | ---- |
| 43 | |
| 44 | Лево: BookISBNId, !GenreId, !WishId, !SwapId, !ReviewId, !ReportId |
| 45 | |
| 46 | Десно: !FirstName, !LastName, Password, City, Neighborhood, Bio, Quote, Title, Author, Language, !ImageURL, ISBN, Genre, Availability, Condition, Priority, !RequestStatus, !RequestDate, !BorrowDate, !ReturnDate, !BorrowDuration, Rating, !ReviewerComment, !ReviewDate, !MsgTime, !MsgDate, !MessageContent ,!DateCreated, !FriendshipStatus, !ReportType, !ReportDate, Details, !ReportStatus, !ReportedEntity, Type, !NotifTime, !NotifDate, Description, !NotificationStatus |
| 47 | |
| 48 | Од двете страни: !UserId, Email, Username, !BookId, !InventoryId, !RequestId, !TransactionId, !MessageId, !FriendshipId, !NotificationId |
| 49 | |
| 50 | |
| 51 | ---- |
| 52 | |
| 53 | |
| 54 | BookISBNId += {!BookId, ISBN, Title, Author, Language, !ImageURL} |
| 55 | |
| 56 | Не ги содржи сите атрибути |
| 57 | |
| 58 | !GenreId += {!BookId, Genre, Title, Author, Language, !ImageURL} |
| 59 | |
| 60 | Не ги содржи сите атрибути |
| 61 | |
| 62 | !WishId += {!UserId, Priority, !BookId, Title, Author, Language, !ImageURL, FirstName, LastName, Email, Username, Password, City, Neighborhood, Bio, Quote} |
| 63 | |
| 64 | Не ги содржи сите атрибути |
| 65 | |
| 66 | !SwapId += {!TransactionId, !RequestId, !UserId, !InventoryId, !BorrowDate, !ReturnDate, !BorrowDuration, !BookId, !RequestStatus, !RequestDate, FirstName, LastName, Email, Username, Password, City, Neighborhood, Bio, Quote, Availability, Condition, Title, Author, Language, !ImageURL} |
| 67 | |
| 68 | Не ги содржи сите атрибути |
| 69 | |
| 70 | !ReviewId += {!TransactionId, !UserId, Rating, !ReviewerComment, !ReviewDate, !RequestId, !InventoryId, !BorrowDate, !ReturnDate, !BorrowDuration, FirstName, LastName, Email, Username, Password, City, Neighborhood, Bio, Quote, !BookId, !RequestStatus, !RequestDate, Availability, Condition, Title, Author, Language, !ImageURL} |
| 71 | |
| 72 | Не ги содржи сите атрибути |
| 73 | |
| 74 | !ReportId += {!UserId, !ReportType, !ReportDate, Details, !ReportStatus, !ReportedEntity, !FirstName, !LastName, Email, Username, Password, City, Neighborhood, Bio, Quote} |
| 75 | |
| 76 | Не ги содржи сите атрибути |
| 77 | |
| 78 | **!ReviewId, BookISBNId, !GenreId, !WishId, !SwapId, !ReportId** = { !ReviewId, !BookISBNId, !GenreId, !WishId, !SwapId, !ReportId, !NotificationId, !TransactionId, !UserId, Rating, !ReviewerComment, !ReviewDate, !InventoryId, !BorrowDate, !ReturnDate, !BorrowDuration, !FirstName, !LastName, Email, Username, Password, City, Neighborhood, Bio, Quote, Availability, Condition, !BookId, Title, Author, Language, !ImageURL, ISBN, Genre, Priority, !ReportType, !ReportDate, Details, !ReportStatus, !ReportedEntity, !MessageId, !FriendshipId, !RequestId, Type, !NotifTime, !NotifDate, Description, !NotificationStatus, !MsgTime, !MsgDate, !MessageContent, !DateCreated, !FriendshipStatus, !RequestStatus, !RequestDate} **Следува дека е единствен кандидат клуч и го прогласуваме за примарен клуч.** |
| 79 | |
| 80 | === Декомпозиција до највисока можна нормална форма |
| 81 | |
| 82 | Релацијата R е во 1НФ, со тоа што вредностите на сите атрибути се атомични, но не е во 2НФ, бидејќи за релацијата не е точно дека секој не-примарен атрибут е целосно функционално зависен од примарниот клуч (!ReviewId, BookISBNId, !GenreId, !WishId, !SwapId, !ReportId), и со тоа имаме парцијални зависности кои ја нарушуваат 2НФ. |
| 83 | |