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