3 | | == |
| 3 | == Определување функциски зависности и да нема нешто со исто име на атрибут |
| 4 | |
| 5 | *s_id = statement_id |
| 6 | |
| 7 | R = { pe_id, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality, o_badge_no, o_password, o_date_of_employment, p_id, p_address, s_id, city, p_date_of_employment, badge_no, rank, p_password, statement_id, statement_date, description, incident_timestamp, incident_place, e_id, e_name, e_type, is_found, e_picture, c_id, c_name, opening_date, c_status, date_of_closing, sc_description, final_document, t_id, t_name } |
| 8 | |
| 9 | pe_id -> first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality \\ |
| 10 | o_badge_no -> pe_id, o_password, o_date_of_employment \\ |
| 11 | p_id -> p_address, o_badge_no, s_id \\ |
| 12 | s_id -> city \\ |
| 13 | badge_no -> pe_id, p_date_of_employment, rank, p_password, p_id \\ |
| 14 | statement_id -> statement_date, description, incident_timestamp, incident_place, e_id, badge_no \\ |
| 15 | e_id -> e_name, e_type, is_found, e_picture \\ |
| 16 | c_id -> c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing \\ |
| 17 | date_of_closing -> sc_description, final_document \\ |
| 18 | t_id -> t_name \\ |
| 19 | |
| 20 | \\ |
| 21 | Лево \\ |
| 22 | c_id |
| 23 | |
| 24 | Лево и десно \\ |
| 25 | pe_id, t_id, o_badge_no, p_id, s_id, badge_no, statement_id, e_id, date_of_closing, t_id |
| 26 | |
| 27 | Десно \\ |
| 28 | first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality, o_password, o_date_of_employment, p_address, city, p_date_of_employment, rank, p_password,statement_date, description, incident_timestamp, incident_place, e_name, e_type, |
| 29 | is_found, e_picture,c_name, opening_date, c_status, sc_description, |
| 30 | final_document, t_name |
| 31 | |
| 32 | c_id+={ c_id, c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing, statement_date, description, incident_timestamp, incident_place, badge_no, e_name, e_type, is_found, e_picture, t_name, p_address, o_badge_no, s_id, sc_description, final_document, city, pe_id, o_password, o_date_of_employment, p_date_of_employment, rank, p_password, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality } \\ |
| 33 | Следува дека е единствен кандидат клуч и го прогласуваме за примарен клуч. |
| 34 | |
| 35 | \\ |
| 36 | Во ваква дефинирана релација нема повеќекратни зависности, па со тоа следува дека задоволува **1НФ**. \\ |
| 37 | Клучот на релацијата е составен само од еден атрибут c_id, што значи дека парцијална зависност не постои, и со тоа заклучуваме дека е задоволена **2НФ**. \\ |
| 38 | Не е во 3НФ бидејќи има транзитивни зависности, пример s_id -> city |
| 39 | |
| 40 | Декомпозиција: |
| 41 | |
| 42 | **R1{__s_id__, city} е во BCNF** |
| 43 | |
| 44 | R2{__c_id__, c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing, statement_date, description, incident_timestamp, incident_place, badge_no, e_name, e_type, is_found, e_picture, t_name, p_address, o_badge_no, s_id, sc_description, final_document, pe_id, o_password, o_date_of_employment, p_date_of_employment, rank, p_password, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality} |
| 45 | |
| 46 | R2 не е во 3НФ поради e_id -> e_name, e_type, is_found, e_picture |
| 47 | |
| 48 | **R21{__e_id__, e_name, e_type, is_found, e_picture } е во BCNF** |
| 49 | |
| 50 | R22{__c_id__, c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing, statement_date, description, incident_timestamp, incident_place, badge_no, t_name, p_address, o_badge_no, s_id, sc_description, final_document, pe_id, o_password, o_date_of_employment, p_date_of_employment, rank, p_password, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality} |
| 51 | |
| 52 | R22 не е во 3НФ поради t_id -> t_name |
| 53 | |
| 54 | **R221{t_id, t_name} е во BCNF** |
| 55 | |
| 56 | R222{c_id, c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing, statement_date, description, incident_timestamp, incident_place, badge_no, p_address, o_badge_no, s_id, sc_description, final_document, pe_id, o_password, o_date_of_employment, p_date_of_employment, rank, p_password, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality} |
| 57 | |
| 58 | R222 не е во BCNF поради pe_id -> first_name, last_name, gender, address, picture, contact, embg, date_of_birth,country, nationality} |
| 59 | |
| 60 | **R2221{__pe_id__, first_name, last_name, gender, address, picture, contact, embg, date_of_birth,country, nationality}е во BCNF** |
| 61 | |
| 62 | R2222{__c_id__, c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing, statement_date, description, incident_timestamp, incident_place, badge_no, p_address, o_badge_no, s_id, sc_description, final_document, pe_id, o_password, o_date_of_employment, p_date_of_employment, rank, p_password} |
| 63 | |
| 64 | R2222 не е во BCNF поради date_of_closing -> sc_description, final_document |
| 65 | |
| 66 | **R22221{__date_of_closing__, sc_description, final_document}е во BCNF** |
| 67 | |
| 68 | R22222{c_id, c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing, statement_date, description, incident_timestamp, incident_place, badge_no, p_address, o_badge_no, s_id, pe_id, o_password, o_date_of_employment, p_date_of_employment, rank, p_password} |
| 69 | |
| 70 | R22222 не е во 3НФ поради o_badge_no -> pe_id, o_password, o_date_of_employment |
| 71 | |
| 72 | **R222221{__o_badge_no__, pe_id, o_password, o_date_of_employment}е во BCNF** |
| 73 | |
| 74 | R222222{__c_id__, c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing, statement_date, description, incident_timestamp, incident_place, badge_no, p_address, o_badge_no, s_id, p_date_of_employment, rank, p_password} |
| 75 | |
| 76 | R222222 не е во 3НФ поради badge_no -> pe_id, p_date_of_employment, rank, p_password, p_id |
| 77 | |
| 78 | **R2222221{__badge_no__, pe_id, p_date_of_employment, rank, p_password, p_id} е во BCNF** |
| 79 | |
| 80 | R2222222{__c_id__, c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing, statement_date, description, incident_timestamp, incident_place, badge_no, p_address, o_badge_no, s_id} |
| 81 | |
| 82 | R2222222 не е во BCNF поради statement_id -> statement_date, description, incident_timestamp, incident_place, e_id, badge_no |
| 83 | |
| 84 | **R22222221{__statement_id__, statement_date, description, incident_timestamp, incident_place, e_id, badge_no} е во BCNF** |
| 85 | |
| 86 | R22222222{__c_id__, c_name, opening_date, c_status, statement_id, t_id, p_id, date_of_closing, p_address, o_badge_no, s_id} |
| 87 | |
| 88 | R22222222 не е во BCNF поради p_id -> p_address, o_badge_no, s_id |
| 89 | |
| 90 | **R222222221{__p_id__, p_address, o_badge_no, s_id} е во BCNF** |
| 91 | |
| 92 | **R222222222{__c_id__, c_name, opening_date, c_status, statement_id, t_id, date_of_closing} тука завршуваме бидејќи е во BCNF.** |
| 93 | |
| 94 | == Релации |
| 95 | **R1 = Statement{__s_id__, city}** |
| 96 | |
| 97 | **R21 = Evidence{__e_id__, e_name, e_type, is_found, e_picture} е во BCNF** |
| 98 | |
| 99 | **R221 = Type_of_crime{__t_id__, t_name} е во BCNF** |
| 100 | |
| 101 | **R2221=People{__pe_id__, first_name, last_name, gender, address, picture, contact, embg, date_of_birth,country, nationality}е во BCNF** |
| 102 | |
| 103 | **R22221 = Solved_case{__date_of_closing__, sc_description, final_document}е во BCNF** |
| 104 | |
| 105 | **R222221 = Officer{__o_badge_no__, pe_id, o_password, o_date_of_employment}е во BCNF** |
| 106 | |
| 107 | **R2222221 = Policeman{__badge_no__, pe_id, p_date_of_employment, rank, p_password, p_id} е во BCNF** |
| 108 | |
| 109 | **R22222221 = Statement{__statement_id__, statement_date, description, incident_timestamp, incident_place, e_id, badge_no} е во BCNF** |
| 110 | |
| 111 | **R222222221 = Police_Station{__p_id__, p_address, o_badge_no, s_id} е во BCNF** |
| 112 | |
| 113 | **R222222222 = Crime_case{__c_id__, c_name, opening_date, c_status, statement_id, t_id, date_of_closing} тука завршуваме бидејќи е во BCNF.** |