| 45 | | Кандидати клучеви се следните: |
| | 45 | |
| | 46 | K+ се пресметува на следен начин: |
| | 47 | |
| | 48 | {{{ |
| | 49 | Чекор 0: K+ = {comment_id, ingredient_id, nutrient_id, restriction_id, list_id, planner_id, bio_id} |
| | 50 | |
| | 51 | Чекор 1: секој идентификатор го определува својот ентитет, па K+ ги добива атрибутите на COMMENT, INGREDIENT, NUTRIENT, RESTRICTION, GROCERY_LIST, INTAKE_PLANNER и BIOMETRICS, а со нив post_id и user_id (од comment_id) плус nutrient_amount и buy_quantity (од паровите што веќе се во K+). |
| | 52 | |
| | 53 | Чекор 2: post_id сега е во K+, па ги додава атрибутите на POST и recipe_id; user_id додава email, username, password, role. |
| | 54 | |
| | 55 | Чекор 3: recipe_id сега е во K+, па додава recipe_name, guide, kcal_sum, servings, а со {recipe_id, ingredient_id} и ingredient_quantity. |
| | 56 | |
| | 57 | Чекор 4: едно цело поминување не додава ништо ново. K+ = R. |
| | 58 | }}} |
| | 59 | Од тоа следи: |
| | 60 | |
| | 61 | ||= K# =||= ingredient =||= nutrient =||= restriction =||= biometrics =|| |
| | 62 | || K1 || ingredient_id || nutrient_id || restriction_id || bio_id || |
| | 63 | || K2 || ingredient_id || nutrient_id || restriction_id || bio_date || |
| | 64 | || K3 || ingredient_id || nutrient_id || restr_description || bio_id || |
| | 65 | || K4 || ingredient_id || nutrient_id || restr_description || bio_date || |
| | 66 | || K5 || ingredient_id || nutr_description || restriction_id || bio_id || |
| | 67 | || K6 || ingredient_id || nutr_description || restriction_id || bio_date || |
| | 68 | || K7 || ingredient_id || nutr_description || restr_description || bio_id || |
| | 69 | || K8 || ingredient_id || nutr_description || restr_description || bio_date || |
| | 70 | || K9 || ingredient_name || nutrient_id || restriction_id || bio_id || |
| | 71 | || K10 || ingredient_name || nutrient_id || restriction_id || bio_date || |
| | 72 | || K11 || ingredient_name || nutrient_id || restr_description || bio_id || |
| | 73 | || K12 || ingredient_name || nutrient_id || restr_description || bio_date || |
| | 74 | || K13 || ingredient_name || nutr_description || restriction_id || bio_id || |
| | 75 | || K14 || ingredient_name || nutr_description || restriction_id || bio_date || |
| | 76 | || K15 || ingredient_name || nutr_description || restr_description || bio_id || |
| | 77 | || K16 || ingredient_name || nutr_description || restr_description || bio_date || |
| | 78 | |
| | 79 | Секој од шеснаесетте содржи и {comment_id, list_id, planner_id}. K1 е целосно сурогат формата и токму таа е избрана за примарен клуч. Сурогат (идентификаторите) атрибутите се непроменливи, додека корисник може да преименува состојка и со тоа K16 да добие друга вредност за истиот ред. |
| | 80 | |
| | 81 | |
| | 82 | |