Changes between Version 1 and Version 2 of normalization


Ignore:
Timestamp:
06/25/25 10:26:59 (21 hours ago)
Author:
155036
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • normalization

    v1 v2  
    11== Нормализација и подобрувања на дизајнот ==
     2
     3Во оваа секција е прикажана нормализацијата на постоечкиот ER модел до трета нормална форма (3NF), за да се отстранат зависностите, се избегне дуплирање на податоци и да се подобри интегритетот.
     4
     5=== **actors**(**actor_id**, **actor_code**, **actor_name**, **country_code**, **type_code**) ===
     6
     7Функционални зависности: 
     8**actor_id** → **actor_code**, **actor_name**, **country_code**, **type_code** 
     9**country_code** → **country_name** 
     10**type_code** → **type_description**
     11
     121NF: Сите атрибути се атомски 
     132NF: Сите не-клучни атрибути зависат целосно од примарниот клуч 
     143NF: Постои транзитивна зависност → **actor_id** → **country_code** → **country_name**
     15
     16Декомпозиција: 
     17**actors**(**actor_id**, **actor_code**, **actor_name**, **country_code**, **type_code**) 
     18**countries**(**country_code**, **country_name**) 
     19**actor_types**(**type_code**, **type_description**)
     20
     21=== **locations**(**location_id**, **full_name**, **country_code**, **adm1_code**, **latitude**, **longitude**, **feature_id**) ===
     22
     23Функционални зависности: 
     24**location_id** → **full_name**, **country_code**, **adm1_code**, **latitude**, **longitude**, **feature_id** 
     25**country_code** → **country_name**
     26
     271NF: Атомски вредности 
     282NF: Зависности од целиот клуч 
     293NF: Транзитивна зависност преку **country_code**
     30
     31Декомпозиција: 
     32**locations**(**location_id**, **full_name**, **country_code**, **adm1_code**, **latitude**, **longitude**, **feature_id**) 
     33**countries**(**country_code**, **country_name**)
     34
     35=== **subscription**(**subscription_id**, **user_id**, **plan_id**, **start_date**, **end_date**, **status**) ===
     36
     37Функционални зависности: 
     38**subscription_id** → **user_id**, **plan_id**, **start_date**, **end_date**, **status** 
     39**status** → **status_description**
     40
     411NF: Атомски атрибути 
     422NF: Сите атрибути зависат од клучот 
     433NF: Транзитивна зависност преку **status**
     44
     45Декомпозиција: 
     46**subscription**(**subscription_id**, **user_id**, **plan_id**, **start_date**, **end_date**, **status_code**) 
     47**statuses**(**status_code**, **status_description**)
     48
     49=== **notifications**(**notification_id**, **user_id**, **event_id**, **notification_date**, **status**) ===
     50
     51Функционални зависности: 
     52**notification_id** → **user_id**, **event_id**, **notification_date**, **status** 
     53**status** → **status_description**
     54
     551NF: Атомски вредности 
     562NF: Зависности од целиот клуч 
     573NF: Транзитивна зависност преку **status**
     58
     59Декомпозиција: 
     60**notifications**(**notification_id**, **user_id**, **event_id**, **notification_date**, **status_code**) 
     61**statuses**(**status_code**, **status_description**)
     62
     63=== Нови релации по нормализација ===
     64
     65CREATE TABLE **countries** ( 
     66 **country_code** VARCHAR(5) PRIMARY KEY, 
     67 **country_name** VARCHAR(100) 
     68);
     69
     70CREATE TABLE **actor_types** ( 
     71 **type_code** VARCHAR(10) PRIMARY KEY, 
     72 **type_description** VARCHAR(100) 
     73);
     74
     75CREATE TABLE **statuses** ( 
     76 **status_code** VARCHAR(20) PRIMARY KEY, 
     77 **status_description** TEXT 
     78);
     79
     80=== Финален дизајн (за **actors**) ===
     81
     82CREATE TABLE **actors** ( 
     83 **actor_id** SERIAL PRIMARY KEY, 
     84 **actor_code** VARCHAR(10) NOT NULL, 
     85 **actor_name** VARCHAR(100) NOT NULL, 
     86 **country_code** VARCHAR(5), 
     87 **type_code** VARCHAR(10), 
     88 FOREIGN KEY (**country_code**) REFERENCES **countries**(**country_code**), 
     89 FOREIGN KEY (**type_code**) REFERENCES **actor_types**(**type_code**) 
     90);