= Верзија 3 == Определување функциски зависности и да нема нешто со исто име на атрибут *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 -> s_id, 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 statement_id -> c_id, statement_date, description, incident_timestamp, incident_place, badge_no e_id -> e_name, e_type, is_found, e_picture c_id -> c_name, opening_date, c_status, e_id, p_id, date_of_closing final_document-> sc_description, date_of_closing t_id -> t_name ### Лево - statement_id - final_document - 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 - t_name - date_of_closing ### Двете - pe_id - o_badge_no - p_id - s_id - badge_no - e_id - c_id statement_id+={statement_id ,c_id, statement_date, description, incident_timestamp, incident_place, badge_no,c_name, opening_date, c_status, e_id, p_id, date_of_closing, pe_id, p_date_of_employment, rank, p_password, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality, p_address, o_badge_no, s_id, city, e_name, e_type, is_found, e_picture} не ги содржи сите атрибути final_document+={final_document, sc_description, date_of_closing} не ги содржи сите атрибути t_id+={t_id, t_name} не ги содржи сите атрибути statement_id, final_document+={statement_id, final_document, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, sc_description, date_of_closing, c_name, opening_date, c_status, e_id, p_id, pe_id, p_date_of_employment, rank, p_password, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality, p_address, o_badge_no, s_id, city e_name, e_type, is_found, e_picture} не ги содржи сите атрибути statement_id, t_id+={statement_id, t_id, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, t_name, c_name, opening_date, c_status, e_id, p_id, date_of_closing, e_name, e_type, is_found, e_picture, p_address, o_badge_no, s_id, city, pe_id, p_date_of_employment, rank, p_password, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality, o_password, o_date_of_employment} не ги содржи сите атрибути final_document, t_id+={final_document, t_id, sc_description, date_of_closing, t_name} не ги содржи сите атрибути **final_document, t_id, statement_id+**={final_document, t_id, statement_id, sc_description, date_of_closing, t_name, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, c_name, opening_date, c_status, e_id, p_id, pe_id, p_date_of_employment, rank, p_password, e_name, e_type, is_found, e_picture, p_address, o_badge_no, s_id, o_password, o_date_of_employment, city, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality} **Следува дека е единствен кандидат клуч и го прогласуваме за примарен клуч.** ``` в) Во ваква дефинирана релација нема повеќекратни зависности, па со тоа следува дека задоволува **1НФ**. Парцијална зависност постои, и со тоа заклучуваме дека не е задоволена **2НФ**. Декомпозиција: **R1{s_id, city}** **е во BCNF** R2{c_id, final_document, t_id, statement_id, sc_description, date_of_closing, t_name, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, c_name, opening_date, c_status, e_id, p_id, pe_id, p_date_of_employment, rank, p_password, e_name, e_type, is_found, e_picture, p_address, o_badge_no, s_id, o_password, o_date_of_employment, 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{ final_document, t_id, statement_id, sc_description, date_of_closing, t_name, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, c_name, opening_date, c_status, e_id, p_id, pe_id, p_date_of_employment, rank, p_password, p_address, o_badge_no, s_id, o_password, o_date_of_employment, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality} --- R22 не е во 3НФ поради pe_id ****-> first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality **R221{pe_id, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality}е во BCNF** R222{ final_document, t_id, statement_id, sc_description, date_of_closing, t_name, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, c_name, opening_date, c_status, e_id, p_id, pe_id, p_date_of_employment, rank, p_password, p_address, o_badge_no, s_id, o_password, o_date_of_employment --- R222 не е во 3НФ поради bange_no → pe_id, p_date_of_employment, rank, p_password **R2221{badge_no, pe_id, p_date_of_employment, rank, p_password} е во BCNF** R2222{final_document, t_id, statement_id, sc_description, date_of_closing, t_name, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, c_name, opening_date, c_status, e_id, p_id, p_address, o_badge_no, s_id, o_password, o_date_of_employment} --- R2222 не е во 3НФ поради o_badge_no -> s_id, pe_id, o_password, o_date_of_employment **R22221{o_badge_no, s_id, pe_id, o_password, o_date_of_employment} е во BCNF** R22222{final_document, t_id, statement_id, sc_description, date_of_closing, t_name, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, c_name, opening_date, c_status, e_id, p_id, p_address, o_badge_no} --- R22222 не е во 3НФ поради p_id -> p_address, o_badge_no, s_id **R222221{p_id, p_address, o_badge_no, s_id}е во BCNF** R222222{final_document, t_id, statement_id, sc_description, date_of_closing, t_name, c_id, statement_date, description, incident_timestamp, incident_place, badge_no, c_name, opening_date, c_status, e_id, p_id} --- R222222 не е во 3НФ поради c _id -> c_name, opening_date, c_status, e_id, p_id, date_of_closing **R2222221{c_id, c_name, opening_date, c_status, e_id, p_id, date_of_closing}е во BCNF** R2222222{final_document, t_id, statement_id, sc_description, t_name, c_id, statement_date, description, incident_timestamp, incident_place, badge_no} --- R2222222 не е во 3НФ поради **t_id** -> t_name R222222221**{t_id, t_name} е во BCNF** R222222222{final_document, t_id, statement_id, sc_description, c_id, statement_date, description, incident_timestamp, incident_place, badge_no} --- R222222222 не е во 3НФ поради final_document-> sc_description, date_of_closing **R222222221{final_document, sc_description, date_of_closing}е во BCNF** R222222222{final_document, t_id, statement_id, c_id, statement_date, description, incident_timestamp, incident_place, badge_no} --- R222222222 не е во 3НФ поради **statement_id** -> c_id, statement_date, description, incident_timestamp, incident_place, badge_no **R2222222221{statement_id , c_id, statement_date, description, incident_timestamp, incident_place, badge_no}е во BCNF** **R2222222222{final_document, t_id, statement_id} е во BCNF** == Релации **Sector_of_interal_affairs{s_id, city}** **е во BCNF** **Evidence{e_id, e_name, e_type, is_found, e_picture} е во BCNF** **People{pe_id, first_name, last_name, gender, address, picture, contact, embg, date_of_birth, country, nationality}е во BCNF** **Policeman{badge_no, pe_id, p_date_of_employment, rank, p_password} е во BCNF** **Officer{o_badge_no, s_id, pe_id, o_password, o_date_of_employment} е во BCNF** **Police_station{p_id, p_address, o_badge_no, s_id}е во BCNF** **Crime_case{c_id, c_name, opening_date, c_status, e_id, p_id, date_of_closing}е во BCNF** **Type_of_crime{t_id, t_name} е во BCNF** **Solved_case{final_document, sc_description, date_of_closing}е во BCNF** **Statement{statement_id , c_id, statement_date, description, incident_timestamp, incident_place, badge_no}е во BCNF** **Statement_and_case{final_document, t_id, statement_id} е во BCNF** *резултатот е различен од оригиналниот модел. Дискусија на разликите: Табелите каде што се чуваат acused, witness и victims се испуштаат. За да се реши ова би можело да има индиректна врска преку Statements со атрибут statement_of каде што можеме да имаме три вредности соодветно acused, witness и victims. Редундантно повторување на слични атрибути, тоа се забележува кај Officer и Policeman. Едно решение за ова би било табела вработени каде што би се чувал атрибут is_officer. Со тоа би се изменила целосната структура на базата и не би ги имале officer и policeman. Имаме исто така директна врска од Crime_case за Evidence, каде што во првичниот модел се индиректно поврзани преку Mentions_evidence и Statements.