Tabela DOSIJE

INDEKS IME PREZIME MESTORODJENJA DATUPISA

Tabela PREDMET

IDPREDMETA OZNAKA NAZIV ESPB

Tabela ISPITNIROK

SKGODINA OZNAKAROKA NAZIV

Tabela ISPIT

INDEKS IDPREDMETA SKGODINA OZNAKAROKA OCENA DATPOLAGANJA BODOVI

Rešiti na relacionoj algebri i relacionom računu

  1. Pronaći indekse studenata koji su predmet sa identifikatorom 1001 polagali tačno dva puta.

    relaciona algebra

    define alias i1 for ispit
    define alias i2 for ispit
    define alias i3 for ispit

    ((i1 times i2) where i1.indeks=i2.indeks and i1.idpredmeta=1001 and
    i2.idpredmeta=1001 and i1.datpolaganja<>i2.datpolaganja)[i1.indeks]
    minus
    ((i1 times i2 times i3) where i1.indeks=i2.indeks and i1.indeks=i3.indeks and
    i1.idpredmeta=1001 and i2.idpredmeta=1001 and i3.idpredmeta=1001 and
    i1.datpolaganja<>i2.datpolaganja and i1.datpolaganja<>i3.datpolaganja and
    i2.datpolaganja<>i3.datpolaganja )[i1.indeks]

    relacioni račun

    range of dx is dosije
    range of ix is ispit
    range of iy is ispit

    range of iz is ispit

    dx.indeks
    where exists ix(ix.indeks=dx.indeks and ix.idpredmeta=1001 and exists iy(
    iy.indeks=dx.indeks and iy.idpredmeta=1001 and ix.datpolaganja<>iy.datpolaganja
    and not exists iz(iz.indeks=dx.indeks and iz.idpredmeta=1001 and
    ix.datpolaganja<>iz.datpolaganja and iy.datpolaganja<>iz.datpolaganja)))

  2. Pronaći predmete koje su položils dva studenta upisana na fakultet istog dana. Izdvojiti datum upisa na fakultet i naziv predmeta.

    relaciona algebra

    define alias ispit1 for ispit
    define alias dosije1 for dosije

    (((ispit where ocena>5) join dosije) times ((ispit1 where ocena>5) join dosije1)
    where ispit.idpredmeta=ispit1.idpredmeta and ispit.indeks<ispit1.indeks and dosije.datupisa=dosije1.datupisa)[ispit.idpredmeta, dosije.datupisa]
    join predmet)[datupisa, naziv]

    relacioni račun

    range of px is predmet
    range of dx is dosije
    range of dy is dosije
    range of ix is ispit
    range of iy is ispit

    dx.datupisa, px.naziv
    where exists ix(ix.indeks=dx.indeks and ix.idpredmeta=px.idpredmeta and ix.ocena>5 and
    exists iy(iy.idpredmeta=px.idpredmeta and iy.ocena>5 and exists dy(dy.indeks<>dx.indeks
    and dx.datupisa=dy.datupisa)))

  3. Pronaći indeks studenta koji