Logicky navrh I.

Plán na cvičenie

  • Vytvorenie relacie
  • Generalizacia
  • Urcenie primarnych klucov
  • Dekompozicia M:N vztahov
  • Urcenie cudzich klucov

Užitočné linky

Vytvorenie relacie

Vytvorte z nasledovneho ERA diagramu relacie.

ERA diagram

Generalizacia vztahov

Zamyslite sa nad vytvorenymi relaciami ci medzi nie je mozne znazornit generalizaciu.


Urcenie primarnych klucov

Urcite primarne kluce pre vytvorene relacie z predchadzajuceho ERA diagramu.


Vztahy z konceptualneho navrhu

Vztahy

Urcenie primarnych klucov

Entity

Best Practices

Pri vybere primarneho kluca je vhodne sa riadit tymito pravidlami :

  1. Primary keys should be as small as necessary. Prefer a numeric type because numeric types are stored in a much more compact format than character formats. This is because most primary keys will be foreign keys in another table as well as used in multiple indexes. The smaller your key, the smaller the index, the less pages in the cache you will use.
  2. Primary keys should never change. Updating a primary key should always be out of the question. This is because it is most likely to be used in multiple indexes and used as a foreign key. Updating a single primary key could cause of ripple effect of changes.
  3. Do NOT use "your problem primary key" as your logic model primary key. For example passport number, social security number, or employee contract number as these "primary key" can change for real world situations.

Natural vs. Surrogate keys rules

Primary Keys Rules
Zdroj: The great primary-key debate - TechRepublic


Dekompozicia M:N vztahov

Pred dekompoziciou M:N vztah

Vztah M:N


Po dekompozicii vztahu M:N na vztah 1:N

Vztah M:N


Urcenie cudzich klucov

Cudze kluce


Výsledok návrhu

Alternatívna návrhu 1

vysledok navrhu
Na stiahnutie PDF: Logicky navrh - zadanie

Alternatívna návrhu 2

vysledok navrhu
Na stiahnutie PDF: Logicky navrh - zadanie


Literatura, odkazy

Clanok o vhodnom vybere primarnych klucov
Literatura - navrh databazy
Semestralne projekt na cvičenia