Version 2 (modified by 8 months ago) ( diff ) | ,
---|
Нормализација и подобрувања на дизајнот на базата
Определување функциски зависности и да нема нешто со исто име на атрибут
*s_id = statement_id
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 }
pe_id -> first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality
o_badge_no -> pe_id, o_password, o_date_of_employment
p_id -> p_address, o_badge_no, s_id
s_id -> city
badge_no -> pe_id, p_date_of_employment, rank, p_password, p_id
statement_id -> statement_date, description, incident_timestamp, incident_place, e_id, badge_no
e_id -> e_name, e_type, is_found, e_picture
c_id -> c_name, opening_date, c_status, statement_id, e_id, t_id, p_id, date_of_closing
date_of_closing -> sc_description, final_document
t_id -> t_name
Лево
c_id
Лево и десно
pe_id, t_id, o_badge_no, p_id, s_id, badge_no, statement_id, e_id, date_of_closing, t_id
Десно
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,
is_found, e_picture,c_name, opening_date, c_status, sc_description,
final_document, t_name
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 }
Следува дека е единствен кандидат клуч и го прогласуваме за примарен клуч.
Во ваква дефинирана релација нема повеќекратни зависности, па со тоа следува дека задоволува 1НФ.
Клучот на релацијата е составен само од еден атрибут c_id, што значи дека парцијална зависност не постои, и со тоа заклучуваме дека е задоволена 2НФ.
Не е во 3НФ бидејќи има транзитивни зависности, пример s_id -> city
Декомпозиција:
R1{s_id, city} е во BCNF
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}
R2 не е во 3НФ поради e_id -> e_name, e_type, is_found, e_picture
R21{e_id, e_name, e_type, is_found, e_picture } е во BCNF
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}
R22 не е во 3НФ поради t_id -> t_name
R221{t_id, t_name} е во BCNF
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}
R222 не е во BCNF поради pe_id -> first_name, last_name, gender, address, picture, contact, embg, date_of_birth,country, nationality}
R2221{pe_id, first_name, last_name, gender, address, picture, contact, embg, date_of_birth,country, nationality}е во BCNF
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}
R2222 не е во BCNF поради date_of_closing -> sc_description, final_document
R22221{date_of_closing, sc_description, final_document}е во BCNF
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}
R22222 не е во 3НФ поради o_badge_no -> pe_id, o_password, o_date_of_employment
R222221{o_badge_no, pe_id, o_password, o_date_of_employment}е во BCNF
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}
R222222 не е во 3НФ поради badge_no -> pe_id, p_date_of_employment, rank, p_password, p_id
R2222221{badge_no, pe_id, p_date_of_employment, rank, p_password, p_id} е во BCNF
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}
R2222222 не е во BCNF поради statement_id -> statement_date, description, incident_timestamp, incident_place, e_id, badge_no
R22222221{statement_id, statement_date, description, incident_timestamp, incident_place, e_id, badge_no} е во BCNF
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}
R22222222 не е во BCNF поради p_id -> p_address, o_badge_no, s_id
R222222221{p_id, p_address, o_badge_no, s_id} е во BCNF
R222222222{c_id, c_name, opening_date, c_status, statement_id, t_id, date_of_closing} тука завршуваме бидејќи е во BCNF.
Релации
R1 = Statement{s_id, city}
R21 = Evidence{e_id, e_name, e_type, is_found, e_picture} е во BCNF
R221 = Type_of_crime{t_id, t_name} е во BCNF
R2221=People{pe_id, first_name, last_name, gender, address, picture, contact, embg, date_of_birth,country, nationality}е во BCNF
R22221 = Solved_case{date_of_closing, sc_description, final_document}е во BCNF
R222221 = Officer{o_badge_no, pe_id, o_password, o_date_of_employment}е во BCNF
R2222221 = Policeman{badge_no, pe_id, p_date_of_employment, rank, p_password, p_id} е во BCNF
R22222221 = Statement{statement_id, statement_date, description, incident_timestamp, incident_place, e_id, badge_no} е во BCNF
R222222221 = Police_Station{p_id, p_address, o_badge_no, s_id} е во BCNF
R222222222 = Crime_case{c_id, c_name, opening_date, c_status, statement_id, t_id, date_of_closing} тука завршуваме бидејќи е во BCNF.