Facebook
From karol, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 226
  1. create table czytelnicy
  2. (
  3. id_czytelnik serial not null,
  4. imie varchar,
  5. Nazwisko varchar,
  6. numer_albumu integer,
  7. primary key(id_czytelnik),
  8. unique (id_czytelnik)
  9. );
  10.  
  11.  
  12.  
  13. create table wypozyczenia
  14. (
  15. id_wypozyczenia serial not null,
  16. id_ksiazki int,
  17. id_czytelnik int not null,
  18. data_wypozyczenia date,
  19. data_zwrotu date,
  20. foreign key (id_czytelnik) references czytelnicy(id) on delete no action,
  21. foreign key (id_ksiazki) references ksiazki(id) on delete no action,
  22. primary key(id_wypozyczenia),
  23. unique (id_wypozyczenia)
  24. );
  25.  
  26. create table ksiazki
  27. (
  28. id_ksiazki serial not null,
  29. isbn int,
  30. tytul varchar,
  31. autor varchar,
  32. wydawnictwo varchar,
  33. rok_wydania int,
  34. primary key(id_ksiazki),
  35. unique (id_ksiazki, isbn)
  36. );
  37.  
  38.  
  39.  
  40.  
  41. alter table wypozyczenia add id_czytelnik int not null;