Uvod u baze podataka, mora li gerund biti "Šahbaz" ?

Došao sam do spoznaje da je gerund "Šahbaz".

"Ganjajući" šta je to uopšte gerund, došao sam do toga da je "associative entity" (asocijativni entitet) termin koji se najčešće koristi. Kako ja, osim u "Top listi nadrealista", ne volim "Šahbaze", pokušaću sebi gerund pretvoriti u nešto "svarljivo".

Wikipedija članak asocijativni entitet:

An associative entity is an element of the Entity-relationship model. The database relational model doesn't offer direct support to many-to-many relationships, even though such relationships happen frequently in normal usage. The solution to this problem is the creation of another table to hold the necessary information for this relationship. This new table is called an associative entity.

An associative entity

An associative entity can be thought of as both an entity and a relationship since it encapsulates properties from both. It is a relationship since it is serving to join two or more entities together, but it is also an entity since it may have its own properties. The associative entity must have identifiers, Primary Keys, for both adjoining tables, but may also contain its own unique identifier and other information about the relationship.

The following guidelines may be used when considering the use of an associative entity:

  • All relationships for the associative entity should be many.
  • The associative entity could have meaning independent of the other entities.
  • The associative entity preferably has a unique identifier, and should also have other attributes.
  • The associative entity may participate in relationships other than the entities of the associated relationship.

Dobro ...

znači asocijativni entitet se redovno javlja u slučajevima  N:N relacija. Ako takve relacije u ER modelu trebamo povezati sa drugim entitetima, onda je asocijativni entitet rješenje. Ovaj wikipedijin primjer mi previše "ne sjeda", pa ću smisliti svoj primjer:

[kupci](*)  (1..N) - <naručuju> - (0..N) - [proizvodi]

"Naručuju" ima sopstveni atribut "količina". Gore se i kaže da ove relacije najčešće imaju sopstvene atribute.

Relaciju <narucuju> radi jasnosti preimenujem u "kupci_narudžbe_proizvoda".

[<kupci_narudžbe_proizvoda>] uzorak podataka:

  • id_kupac, id_proizvod, kolicina
  • k01, p01, 10
  • k01, p02, 5
  • k01, p10, 7
  • k02, p02, 1
  • k03, p05, 44

tako uočavamo da je relacija naručuju asocijativni entitet. Asocijativni entitet moze ući u novu relaciju. Primjer:

[<kupci_narudžbe_proizvoda>] (0..1) - <odobrava> - (0..N)  [menadžer]

Gornja relacija nam kazuje da narudžbe kupaca odobrava manager. Narudžba može biti neodobrena - tako da je nije preuzeo manager (min kardinalitet 0 na lijevoj strani relacije), ili obrađena od strane jednog menadžera (max kardinalitet na lijevoj strani relacije).

Jedan menadžer može obraditi 0-N narudžbi.

E sada mi gerund prestaje biti "Šahbaz". Čekaj malo, šta je gerund ?!

---

(*) prikaz ER elemenata u tekstualnoj formi: [entitet], <relacija>, [<asocijativni_entitet>]

6832 views and 0 responses